This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
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.