This is the mail archive of the libstdc++@gcc.gnu.org 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::operator[]


Howard Hinnant wrote:

> [snip]

> In this particular example, I knew that vector::iterator was a 
> wrapper class.  The wrapper class is a very thin layer that should be 
> optimized away in release mode, but definitely is not optimized away 
> in debug mode.  Internal to vector one has a pointer to the data.  
> There is very little to be gained (actually nothing) by implementing 
> vector's internals with iterators instead of pointers.  I.e. Keep 
> things as simple as possible. 

Thanks. In general, one can only agree with such a principle! In this
particular case, for libstdc++, we have also a compelling reason in ADL
to avoid iterators internally. Asap, I'll do an audit of vector for this
issue: besides operator[] and size() (thanks Jonathan!), certainly there
a few other places needing care (capacity, ...)

Paolo.


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