Boost logo

Boost :

From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2006-12-09 14:30:07

me22 wrote:

> I'm fairly certain that this does not need to be the case.
> There was a thread a while back about going though the sources to look
> for uses of list::size exactly because it could be O(n) to ensure that
> there was always an O(1) empty-using function as an alternative to
> size.

I thought containers were only supposed to provide operations if those
were efficient.
If std::list::size is linear, then it shouldn't have been provided and
std::count should have been used instead.

I do not have the time to check the spec though, so I'll believe you if
you say it's not guaranteed to be O(1).

Boost list run by bdawes at, gregod at, cpdaniel at, john at