CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Join Date
    Apr 1999
    Posts
    27,449

    Re: STL Map Iteration Question

    Quote Originally Posted by TSYS View Post
    Yes, Philip's code does what I intended, without the equality that bothers you, Paul.
    It's not a matter of bothering me, it's really for your benefit to write comparisons this way (without the test for equality). As mentioned, testing for equality as early as you did is the foundation of badly written comparison operators that ultimately break the strict weak ordering rule, maybe not now, but later if the ordering becomes more complex.

    I suggest you take Martin O's code, compile it, run it, and see if it works. If it does work, then it's your job to make it not work by adding something to it and repost the changed example. Or if not that, figure out what the code he posted does and your's doesn't do.

    Regards,

    Paul McKenzie

  2. #17
    Join Date
    Oct 2002
    Posts
    1,134

    Re: STL Map Iteration Question

    Well, Martin's code certainly works, so now I have to find out what's on the periphery screwing things up.

    Thanks to everybody for your help.
    Regards
    Robert Thompson

  3. #18
    Join Date
    Mar 2009
    Posts
    51

    Re: STL Map Iteration Question

    In Visual Studio 2005, the iterator's operator++ seems to be checking whether the iterator does not belong to a map at all and/or whether it has reached the last element in the map - in which case the "map/set iterator not incrementable" error is issued.

    So it is not saying that this type of iterator cannot be incremented, but the specific instance cannot be incremented.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured