My compiler refuse to compile this simple code:
struct mystruct{
int x;
bool operator<(const mystruct& y) const{ return x < y.x; }
};
std::map<mystruct, int> test;
auto it = std::lower_bound(test.begin(), test.end(), mystruct{2});
I'm getting the error
error C2893: Failed to specialize function template 'unknown-type std::less<void>::operator ()(_Ty1 &&,_Ty2 &&) const'
Looking at this link, it seems that you just need to define a constant comparison operator which is exactly what I'm doing. Is there something I am missing here?