Boost logo

Boost :

From: Joe Gottman (jgottman_at_[hidden])
Date: 2008-02-07 19:59:48

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));

Joe Gottman

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