This is the mail archive of the
mailing list for the libstdc++ project.
Re: [RFC] libstdc++/8780
- From: Martin Sebor <sebor at roguewave dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Wed, 04 Dec 2002 10:17:01 -0700
- Subject: Re: [RFC] libstdc++/8780
- Organization: Rogue Wave Software, Inc.
- References: <200212040233.gB42XLV24261@piper.synopsys.com>
- Reply-to: libstdc++ at gcc dot gnu dot org
Joe Buck wrote:
This should be an FAQ, along with suggestions on how users can fix their
code that implicitly assumes that std::vector<T>::iterator is T*. Even
programmers who know better tend to make this mistake when they develop
code on compilers that use such an implementation.
The short answer is that, given
has type T* and points to the same object. As the elements of a vector
must be contiguous, this works portably.
Unfortunately, it will not work for an iterator pointing at the end
of a container.