473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

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

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
3 2934
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steven T. Hatton | last post by:
I've been working a lot with OpenSceneGraph lately. Overall it is very much in the spirit of C++. One feature OSG has which is, IMO, an eyesore, is the presence of a couple of #MACROs to assist...
8
by: Mike Nolan | last post by:
As far as I can tell, Postgres has no equivalent to greatest and least functions in Oracle. Yes, you can do the same thing with a case statement, but at the expense of writing MUCH longer SQL...
4
by: chrisstankevitz | last post by:
This code does not compile on gcc 3.4.4. Should it? Thanks for your help, Chris //================ #include <set> int main()
2
by: ehui928 | last post by:
hi, everybody I am a newbie in STL. When I compile the following program under gcc4.0, I got a the following errors. I wonder whether the form of list< vector<string> > is correct in STL ? //...
2
by: Arvid Requate | last post by:
Hello, I'd like to understand why the following code does not compile. It looks like a strangeness in connection with overload resolution for the <complex> header: The conversion operator...
7
by: Renzr | last post by:
I have a problem about the std::set<>iterator. After finding a term in the std::set<>, i want to know the distance from the current term to the begin(). But i have got a error. Please offer me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.