When copying data from one range to another, you have to be careful if there\'s partial overlap between the source and destination ranges. If the beginning of the destinati
Preconditions for std::copy, prohibits an overlap:
Prototype
template
OutputIterator copy(InputIterator first, InputIterator last, OutputIterator result); Preconditions
[first, last)
is a valid range.- result is not an iterator within the range
[first, last)
.- There is enough space to hold all of the elements being copied. More formally, the requirement is that
[result, result + (last - first))
is a valid range. [1]