11.6.4 Swapping Elements
ForwardIterator2 swap_ranges (ForwardIterator1 beg1, ForwardIterator1 end1, ForwardIterator2 beg2) • Swapstheelementsintherange[beg1,end1)withthecorrespondingelementsstartingwithbeg2. • Returns the position after the last swapped element in the second range. • The caller must ensure that the second range is big enough. • Both ranges must not overlap. • To swap all elements of a container of the same type, use its swap() member function because the member function usually has constant complexity (see Section 8.4, page 407). • Complexity: linear (numElems swap operations). The following example demonstrates how to use swap_ranges