operator!= - map<int, pair>::rend() - linux

E

eiji.anonremail

Hi folks,

I have a compile problem on linux, and maybe someone has an idea:



#include <map>
#include <iostream>


class Test {
int i;
};

int main(int argc, char* argv[])
{
std::map<int, std::pair<int,const Test*> > range_map;

range_map.insert(
std::make_pair(
0,
std::make_pair<int,const Test*>(0,new Test)
)
);

range_map.insert(
std::make_pair(
1,
std::make_pair<int,const Test*>(1,new Test)
)
);

std::map<int, std::pair<int,const Test*> >::const_reverse_iterator
range_map_riter;
for(range_map_riter = range_map.rbegin(); range_map_riter !=
range_map.rend(); ++range_map_riter)
{
std::cout said:
second.first) << std::endl;
}

return 0;
}


On win32 this works, but on linux I get a compiler error like this:

main.cpp:31: error: no match for 'operator!=' in
'range_map_riter != std::map<_Key, _Tp, _Compare, _Alloc>::rend()
[with
_Key = int, _Tp = std::pair<int, co
nst Test*>, _Compare = std::less<int>, _Alloc =
std::allocator<std::pair<const int, std::pair<int, const
Test*> > >]()'


Help is much appreciated.

eiji
 
D

Darío Griffo

On win32 this works, but on linux I get a compiler error like this:

main.cpp:31: error: no match for 'operator!=' in
'range_map_riter != std::map<_Key, _Tp, _Compare, _Alloc>::rend()
[with
_Key = int, _Tp = std::pair<int, co
nst Test*>, _Compare = std::less<int>, _Alloc =
std::allocator<std::pair<const int, std::pair<int, const
Test*> > >]()'

Help is much appreciated.

eiji

Works for my in Debian testing with g++ 4.3.1
 
L

Lionel B

On win32 this works, but on linux I get a compiler error like this:

main.cpp:31: error: no match for 'operator!=' in 'range_map_riter !=
std::map<_Key, _Tp, _Compare, _Alloc>::rend() [with
_Key = int, _Tp = std::pair<int, co
nst Test*>, _Compare = std::less<int>, _Alloc =
std::allocator<std::pair<const int, std::pair<int, const Test*> > >]()'

Help is much appreciated.

eiji

Works for my in Debian testing with g++ 4.3.1

And here (RHEL 5) with g++ 4.1.2, 4.3.0 and 4.3.1 and also Intel ICC
(icpc) 10.1

What is your system and compiler version? Sounds like possibly an old GCC.
 
Z

Zeppe

Lionel said:
What is your system and compiler version? Sounds like possibly an old GCC.

gcc 4.0 doesn't compile it. I guess, from gcc 4.1 onwards.

Best wishes,

Zeppe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,961
Messages
2,570,131
Members
46,689
Latest member
liammiller

Latest Threads

Top