Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-03-01 08:56:51


shunsuke wrote:
> Thorsten Ottosen wrote:

>>Only for random access iterators. std::size() would only accept random
>>access iterators.
>
>
> Hmm, when should I use 'std::size'?
> Whenever the argument is known to be RandomAccessRange,
> the 'std::distance' is known to be O(1) complexity.
> Thus, I will always use 'std::distance'.
> (I actually replaced all the 'boost::size' in my codes
> by 'boost::distance'.)

Right, but size() adds a compile time check to that. Of course,
you may get that with a concept check in the beginning too.

-Thorsten


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