vector<T>::iterator

Phil Edwards phil@jaj.com
Thu Jul 31 00:43:00 GMT 2003


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.

It Would Be Nice[tm] if we had an anti-debug mode, kind of like the
-funsafe-math optimization option, that allows users who know what they're
doing (or think they do), to bypass the checks.  -flet-me-shoot-myself-in-
the-foot, perhaps.  Perhaps.

Alternatively, the wrapper class should be able to be mostly inlined
out of existence.  For more info, opinions, and flamage, see this months'
edition of "What Should 'Inline' Do?," currently playing in gcc@gcc.gnu.org
under the name "std::pow".


Phil

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams



More information about the Libstdc++ mailing list