I've got a map declared as:
std::map< std::pair<int, int>, bool > allPositions
(essentially, keys are just 2D points).
I need to get the range of its elements whose values are true
Using std::equal_range
auto range = std::equal_range(allPositions.begin(), allPositions.end(), true);
gives these errors
Error C2672 'operator __surrogate_func': no matching overloaded function found xutility
Error C2893 Failed to specialize function template 'unknown-type std::less<void>::operator ()(_Ty1 &&,_Ty2 &&) const' xutility
Error C2056 illegal expression xutility
Error C2672 'operator __surrogate_func': no matching overloaded function found algorithm
Error C2893 Failed to specialize function template 'unknown-type std::less<void>::operator ()(_Ty1 &&,_Ty2 &&) const' algorithm
I think I don't need predicate function here because std::pair
has got overloaded operator <
- otherwise map code wouldn't have been compiled
So how to use std::equal_range for map to get range of equal values ?
Aucun commentaire:
Enregistrer un commentaire