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: [C++] Should the complexity of std::list::size() be O(n) or O(1)?


Peter Dimov wrote:

> It is not possible to do the optimization by adding overloads to f(),
> because in
>
> template<class T> void f( vector<T>::iterator first,
> vector<T>::iterator last );
>
> T is a nondeduced context (*).

Indeed.

> You _can_ do the optimization in the implementation of the C++
> library, but not in user code.

Ah, this is the point I was missing!

Thanks,
Paolo.


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