This is the mail archive of the
mailing list for the libstdc++ project.
Re: reducing needless normal_iterator usage in vector
On Tue, Jul 02, 2002 at 07:16:41PM +0200, Theodore Papadopoulo wrote:
> email@example.com said:
> > Replacing simple expressions like "begin() + n" with "_M_start + n"
> > skips the normal_iterator ctor and the normal_iterator's overloaded
> > ops, and gets right to the pointer arithmetic that we eventually do
> > anyway.
> I believe the only reason is for abstraction. If someone, one day,
> redefine normal_iterator to be something else than a pointer, he will
> not have to re-examinate all the vector code but just implement a
> normal_iterator class that provides the relevant operations.
That would not affect the internals at all. We must always use a simple
pointer in the underlying operations, just because we're required to use
contiguous storage in a vector. The external iterator implementation can
be normal_iterator or anything more complicated; that has nothing to do
with it. I'm saying that we don't need to use any of that for the internals.
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