Boost logo

Boost :

From: Damien Fisher (damien_at_[hidden])
Date: 2002-05-15 09:31:40


On Thu, 16 May 2002, Damien Fisher wrote:

> template<typename Container>
> bool is_n_elements(const Container &cont, unsigned int n)
> {
> // ...
> }

I should point out that this function would have complexity O(n), where
n is the parameter passed in, whereas using std::list<T>::size() would
result in complexity O(m), where m is the size of the list. Using the
above would then only really be necessary/useful if m >> n.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk