Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range] sub_range and list not working together
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-07-13 16:30:04


Den 13-07-2011 22:24, Brian Wood skrev:
.
>
> Thanks. I found this thread which is closely related to what I'm wondering.
> http://boost.2283326.n4.nabble.com/Distance-size-of-boost-ranges-for-std-set-td2989642.html
>
> I haven't checked into this much, but would using boost::distance
> when the underlying container is a deque or vector, be slower than
> using the container's size?

Not "big-O slower". But it all dependends on e.g. the vector
implementation. If size() is implemented as last - first, then it is the
same. If size is cached in the vector, then yes.

-Thorsten


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