Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-02-13 08:06:04


Joe Gottman skrev:
> When I use copy_range() to assign a range to an existing container an
> unnecessary temporary object is created then assigned to the target.
> This can be inefficient, especially if the target is a vector or string
> which may have a large enough capacity() that no reallocation is
> required for the assignment. Therefore, I’d like to request a new range
> algorithm, assign_from_range, that is defined as follows:
>
>
>
> template<class Sequence, class ForwardRange>
> inline Sequence &assign_from_range(Sequence &target, const ForwardRange &r)
> {
> return target.assign(begin(r), end(r));
> }
>

Do you object to the name assign_range()?

I think the various range_ex libraries being proposed will include this
as part of the range-based algorithms, so I hesitate a bit to add it.

-Thorsten


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