Re: Release-mode only falure when comparing STL list::iterator-s
- From: peter.koch.larsen@xxxxxxxxx
- Date: 17 Apr 2006 01:09:01 -0700
Ivan Vecerina skrev:
[snip]
Indeed, this seems to be a problem with a runtime-check infrastructure
shared by iterators of all containers of this STL implementation.
Quite a nuisance.
I will consider the suggested workaround:
#define _SECURE_SCL to 0
But for now the alternative fix I found will do: compare
the *addresses* of pointed-to elements instead of the
iterators, i.e. (a==b) --> (&*a==&*b)
This works only so long as both a and b point to data if one of these
equal end() you are technically dealing with undefined behavior. This
could give you real life problems only if the library should decide to
check for this. A real worry for debug builds.
/Peter
The most important for me is to know I have no undefined
behavior in my code. I was able to verify this in the
standard. (in the 1998 version of the standard that I
have, this statement appears under 23.1/10:
<< no swap() function invalidates any references, pointers,
or iterators referring to the elements of the containers
being swapped. >>
Thank you Tom for your excellent pointers,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
.
- Follow-Ups:
- Re: Release-mode only falure when comparing STL list::iterator-s
- From: Ivan Vecerina
- Re: Release-mode only falure when comparing STL list::iterator-s
- References:
- Release-mode only falure when comparing STL list::iterator-s
- From: Ivan Vecerina
- Re: Release-mode only falure when comparing STL list::iterator-s
- From: Tom Widmer [VC++ MVP]
- Re: Release-mode only falure when comparing STL list::iterator-s
- From: Ivan Vecerina
- Release-mode only falure when comparing STL list::iterator-s
- Prev by Date: Re: Release-mode only falure when comparing STL list::iterator-s
- Next by Date: Re: Is there analog of std::mem_fun_t, but for data members?
- Previous by thread: Re: Release-mode only falure when comparing STL list::iterator-s
- Next by thread: Re: Release-mode only falure when comparing STL list::iterator-s
- Index(es):
Relevant Pages
|