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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eiji.anonremail@googlemail.com

    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,c onst Test* range_map;

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

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

    std::map<int, std::pair<int,c onst Test*::const_re verse_iterator
    range_map_riter ;
    for(range_map_r iter = range_map.rbegi n(); range_map_riter !=
    range_map.rend( ); ++range_map_rit er)
    {
    std::cout << (range_map_rite r->first) << " " << (range_map_rite r-
    >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_rite r != 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

  • =?ISO-8859-1?Q?Dar=EDo_Griffo?=

    #2
    Re: operator!= - map&lt;int, pair&gt;::rend( ) - linux

    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_rite r != 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


    Comment

    • Lionel B

      #3
      Re: operator!= - map&lt;int, pair&gt;::rend( ) - linux

      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_rite r !=
      >std::map<_Ke y, _Tp, _Compare, _Alloc>::rend() [with
      >_Key = int, _Tp = std::pair<int, co
      >nst Test*>, _Compare = std::less<int>, _Alloc =
      >std::allocator <std::pair<cons t 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

      Comment

      • Zeppe

        #4
        Re: operator!= - map&lt;int, pair&gt;::rend( ) - linux

        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

        Comment

        Working...