This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: vector<T>::iterator

Phil Edwards <> writes:

| On Wed, Jul 30, 2003 at 04:44:09PM -0700, Matt Austern wrote:
| > On Wednesday, July 30, 2003, at 07:59  AM, Thomas Kunert wrote:
| > >The only disadvantage I see it that T* allows the user to write 
| > >non-portable
| > >code. This is not really a problem, because such code will be found 
| > >immediately
| Actual history shows that such code is /not/ found immediately, if ever.
| > >Am I missing something?
| > 
| > Only the history.  Vector<T>::iterator used to be T*.  The libstdc++ 
| > maintainers deliberately changed it to be a class that wraps T*, with 
| > full awareness of both the advantages and disadvantages you mention.  I 
| > don't think there's any chance of convincing them to change it back.
| Somewhere between slim and none, yes.

Interestingly, James Kanze analyzed (today) a program snippet  --
posted the French newsgroup fr.comp.lang.c++ -- to be malfunctionning
because std::vector<T>::iterator being T* was happily accepted in a
situation where more stringent type requirements would have caught it
as a type violation. 

-- Gaby

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]