Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Standard C++ Library Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

swap_ranges()

Module:  Standard C++ Library   Library:  Algorithms


Function

Local Index

No Entries

Summary

Algorithm that exchanges a range of values in one location with those in another

Synopsis

#include <algorithm>

namespace std {
  template <class ForwardIterator1, class ForwardIterator2>
  ForwardIterator2 
  swap_ranges(ForwardIterator1 start1,
              ForwardIterator1 finish1,
              ForwardIterator2 start2);
}

Description

The swap_ranges() algorithm exchanges corresponding values in two ranges, in the following manner:

For each non-negative integer n < (finish - start), the function exchanges *(start1 + n) with *(start2 + n)). After completing all exchanges, swap_ranges() returns an iterator that points to the end of the second container (in other words, start2 + (finish1 -start1)). The result of swap_ranges() is undefined if the two ranges [start, finish) and [start2, start2 + (finish1 - start1)) overlap.

Example

See Also

iter_swap(), swap()

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 25.2.2



Previous fileTop of DocumentContentsIndex pageNext file

Copyright (c) 1994-2006 Rogue Wave Software, a Quovadx Division.
Licensed under the Apache License, Version 2.0.
Contact Rogue Wave about documentation or support issues. You can also seek help from other developers through the Apache stdcxx community (see below).

For more information on the Rogue Wave Standard C++ Library under open source, see Section 1.2 of the user's guide.