|
Boost : |
Subject: Re: [boost] [Containers] Review
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-08-10 18:32:46
> Regarding the batched insert, we have previously discussed the
> complexity of inserting a range. Fundamentally, however, I don't think
> it is acceptable to have efficient insertion ONLY in the case of the
> insert(begin,end) method: it is too common to want to insert several
> values in a loop without creating a temporary container. I'm not aware
> of any established (i.e. std:: or boost::) pattern for doing this:
There is no need to create a temporary container to use a method that
takes a pair of iterators. With the help of the Boost.Range library
and some lambdas (Boost.Phoenix or C++0x, depending on your taste
and constraints), you should be able to create a lazy range view
of wherever you're getting your data from in your loop.
I do this fairly regularly in the code I write, and it has worked
well for me. On occasion I need to write a custom iterator, but
that is by far the exception and not the rule.
There is also a Boost.Range extension library called P-Stade Oven [1]
which provides many additional range algorithms and range adaptors;
I've found these very helpful too.
Regards,
Nate
[1] http://p-stade.sourceforge.net/oven/doc/html/index.html
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk