|
-
March 31st, 2009, 12:56 PM
#16
Re: STL Map Iteration Question
 Originally Posted by TSYS
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
-
March 31st, 2009, 01:33 PM
#17
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
-
April 1st, 2009, 07:36 AM
#18
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|