Boost logo

Boost Users :

Subject: Re: [Boost-users] Best way to put N ranges into a new container?
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2010-07-07 18:11:37

> The constructor of vector and its assign member function are already
> optimized to exploit random access iterators.

I would hope that is the case (for Dinkumware via Microsoft), and that it would be rather efficient for other cases where it can be relaxed, and going down to a single memcpy is the most extreme case.

So, a lazy evaluator would combine cat(R1)(R2)(R3) into a single object that has an implicit conversion to vector, which works by creating a vector and hoping for RVO. That function's body can look at the total size and reserve it, then append each range in turn. I'm hoping/supposing that the natural way to append to a vector, which seems to be vector<T>::insert with Where being end(), is also optimized suitably. And, in terms of what I'm planning, that Boost.Range's natural way of appending a range to a vector calls that.

> Note however that a joined range of random access ranges doesn't know
> that every joined range is the same size, so its random access features
> are a bit slow.

Makes sense.


TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at