This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Should the complexity of std::list::size() be O(n) or O(1)?
Howard Hinnant <hhinnant@apple.com> writes:
[...]
| In general, the design of the std::lib allowed for this situation.
| For example push_front was purposefully not added to vector because
| clients would likely have mistaken it for an O(1) operation. Adding
| push_front to vector and simply saying:
|
| > Using push_front() must require the same attention as
| > choosing the right containers given reference/invalidation constraints
| > and algorithmic complexities.
|
| is just not an acceptable interface design.
Good. That is not what I'm saying.
-- Gaby