By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,276 Members | 1,418 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,276 IT Pros & Developers. It's quick & easy.

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

P: n/a
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 << (range_map_riter->first) << " " << (range_map_riter-
>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

Jul 18 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Jul 18, 12:22*pm, eiji.anonrem...@googlemail.com wrote:
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
Jul 18 '08 #2

P: n/a
On Fri, 18 Jul 2008 08:36:53 -0700, Dar√*o Griffo wrote:
On Jul 18, 12:22¬*pm, eiji.anonrem...@googlemail.com wrote:
>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.

--
Lionel B
Jul 18 '08 #3

P: n/a
Lionel B wrote:
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
Jul 18 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.