Looking for Help/Examples for Linked Lists (C++)

Started by
10 comments, last by visitor 14 years, 10 months ago
Quote:Original post by Zahlman
I was sure I remembered seeing something like that, but then I couldn't find it when I tried looking it up. x.x

It's not easy to find.
#include <utility>using namespace std::rel_ops;
Advertisement
Thanks, I didn't know that.

However, while after replacing boost::less_than_comparable with that the direct comparisons with <= and => in code are alright, std::greater<Test> still fails to compile:

C:/MingW/include/c++/3.4.5/bits/stl_function.h:     In member function `bool std::greater<_Tp>::operator()(const _Tp&, const _Tp&) const     [with _Tp = Test]':C:/MingW/include/c++/3.4.5/bits/list.tcc:324:       instantiated from `void std::list<_Tp, _Alloc>::merge(std::list<_Tp, _Alloc>&, _StrictWeakOrdering)     [with _StrictWeakOrdering = std::greater<Test>, _Tp = Test, _Alloc = std::allocator<Test>]'C:/MingW/include/c++/3.4.5/bits/list.tcc:360:       instantiated from `void std::list<_Tp, _Alloc>::sort(_StrictWeakOrdering)     [with _StrictWeakOrdering = std::greater<Test>, _Tp = Test, _Alloc = std::allocator<Test>]'C:\cprograms\Untitled1.cpp:47:   instantiated from hereC:/MingW/include/c++/3.4.5/bits/stl_function.h:218:     error: no match for 'operator>' in '__x > __y'


Or more precisely, it seems it also needs:
using std::rel_ops::operator>;


Is this a problem with library implementation / compiler / C++ namespaces? (I remember vaguely some similar problem with how to get compiler choose user-defined swap method).

This topic is closed to new replies.

Advertisement