
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