Is there a std::copy-like algorithm that accepts four iterators, denoting two ranges?
Basically, it should stop copying as soon as either range is exhausted:
template<typename Iter>
void copy_range(Iter begin1, Iter end1, Iter begin2, Iter end2)
{
for (; (begin1 != end1) && (begin2 != end2); ++begin1, ++begin2)
{
*begin2 = *begin1;
}
}