Gabriel Dos Reis
Thu Jul 31 02:50:00 GMT 2003
Phil Edwards <email@example.com> 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.
More information about the Libstdc++