I'm trying to retrieve the value from the biggest key on my map, being the value a vector, and also trying to save that value into a new vector. The map keys are double, and values are vectors.
This is my map:
map <double, vector<long>> correlationValues1;
And I want to get the value with the highest key (Assuming map keys are sorted on ascending order):
vector<long> finalDirections1 = (correlationValues1.end())->second;
When I compile I get the error:
Error C2664 'std::pair<const _Kty,_Ty>::pair(std::pair<const _Kty,_Ty> &&)': el argumento 2 no puede convertirse de 'std::vector<double,std::allocator<_Ty>>' a 'const std::vector<long,std::allocator<_Ty>> &' TDI c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.12.25827\include\xmemory0 945
Help anyone?
P.S: Sorry for my poor English.
P.P.S: Thanks for all the support guys!! It still delivers that compilation error... @the boy, I tried your method but still not working...
I don't know if this is actually influential, but when I place the keys and values into the map I use .emplace():
vector<double> arr1;
arr1.push_back(temp1.FirstRow());
arr1.push_back(temp1.LastRow());
arr1.push_back(temp1.FirstCol());
arr1.push_back(temp1.LastCol());
vector<double> arr2;
arr1.push_back(temp2.FirstRow());
arr1.push_back(temp2.LastRow());
arr1.push_back(temp2.FirstCol());
arr1.push_back(temp2.LastCol());
correlationValues1.emplace(correlation, arr1);
correlationValues2.emplace(correlation, arr2);
I have no idea why it happens...