Boost logo

Boost :

From: Joe Gottman (jgottman_at_[hidden])
Date: 2008-02-14 19:29:36

Thorsten Ottosen wrote:
> 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.

    assign_range is fine for the name, but I'd prefer to see this as
part of the base range library, especially if the range_ex libraries
aren't likely to be in boost 1.36.

Joe Gottman

Boost list run by bdawes at, gregod at, cpdaniel at, john at