KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What is happening there? #include <functional> namespace A { struct Class { }; } bool operator<(const A::Class& a, const A::Class& b) { return false; } int main() { std::less<A::Class>()(A::Class(), A::Class()); return 0; } This is compiled ok. But if I use. #include <set> I got errors: g++ test.cc -o test In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4/bits/stl_tree.h:64:0, from /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4/set:60, from lookup.cc:1: /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4/bits/stl_function.h: In member function 'bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = A::Class]': test.cc:15:49: instantiated from here /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4/bits/stl_function.h:230:22: error: no match for 'operator<' in '__x < __y' make: *** [test] Error 1
Tags (comma-separated)
Save Edits
Cancel