Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-05-17 13:49:39

----- Original Message -----
From: "Dave Harris" <brangdon_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, May 17, 2002 3:22 PM
Subject: Re: [boost] is_single_element?

> template <typename iterator>
> bool is_distance( iterator first, iterator last, int n ) {
> return std::distance( first, last ) == n;
> }
> but with complexity O(min(m,n)) rather than O(m) (where m is the length of
> the sequence). Actually the above is O(1) for random access iterators, so
> we just need to specialise for other iterators.
Aha! This answers the question in my previous message... (if it arrives
before this one :-)

Fernando Cacciola
Sierra s.r.l.

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