Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-09-25 10:17:05


Neal Becker skrev:
> boost::size of a std::list gives:
>
> /usr/local/src/boost.hg/boost/range/size.hpp:28: error: no match
> for 'operator-' in 'boost::end [with T = std::list<double,
> std::allocator<double> >](((const std::list<double, std::allocator<double>
>> &)((const std::list<double, std::allocator<double> >*)r))) - boost::begin
> [with T = std::list<double, std::allocator<double> >](((const
> std::list<double, std::allocator<double> >&)((const std::list<double,
> std::allocator<double> >*)r)))'
>
> I would hope that boost::size (type with member .size()) would use the
> member .size().

Use boost::distance( my_list );

size() was changed to reflect O(1) complexity.

-Thorsten


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