Boost logo

Boost Users :

Subject: [Boost-users] [Range] size and list, for example.
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2013-04-10 06:08:33


I know this has come up before, so I'm really seeking to discover the
current situation.

boost::size( std::list<...> ) fails because the implementation of size is
end - begin.

I know I could use distance, but am surprised size(list) doesn't work out
of the box.

* So, is it correct that size(list) doesn't work?

* Does distance(begin, end) specialise for random access iterators to O(n)
performance?

* Why doesn't size similarly specialise?

Thx,

Rob.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net