Brian Silverman | 598d029 | 2018-08-04 23:56:47 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | Copyright 2010 Neil Groves |
| 3 | Distributed under the Boost Software License, Version 1.0. |
| 4 | (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 5 | /] |
| 6 | [section:swap_ranges swap_ranges] |
| 7 | |
| 8 | [heading Prototype] |
| 9 | |
| 10 | `` |
| 11 | template<class SinglePassRange1, class SinglePassRange2> |
| 12 | SinglePassRange2& swap_ranges(SinglePassRange1& rng1, SinglePassRange& rng2); |
| 13 | `` |
| 14 | |
| 15 | [heading Description] |
| 16 | |
| 17 | `swap_ranges` swaps each element `x` in `rng1` with the corresponding element `y` in `rng2`. |
| 18 | Returns a reference to `rng2`. |
| 19 | |
| 20 | [heading Definition] |
| 21 | |
| 22 | Defined in the header file `boost/range/algorithm/swap_ranges.hpp` |
| 23 | |
| 24 | [heading Requirements] |
| 25 | |
| 26 | * `SinglePassRange1` is a model of the __single_pass_range__ Concept. |
| 27 | * `SinglePassRange1` is mutable. |
| 28 | * `SinglePassRange2` is a model of the __single_pass_range__ Concept. |
| 29 | * `SinglePassRange2` is mutable. |
| 30 | |
| 31 | [heading Complexity] |
| 32 | |
| 33 | Linear. Exactly `distance(rng1)` elements are swapped. |
| 34 | |
| 35 | [endsect] |
| 36 | |
| 37 | |