| Home | Libraries | People | FAQ | More

##### swap_ranges

###### Prototype

    template<class SinglePassRange1, class SinglePassRange2>
    SinglePassRange2& swap_ranges(SinglePassRange1& rng1, SinglePassRange& rng2);

###### Description

`swap_ranges` swaps each element `x` in `rng1` with the corresponding element `y` in `rng2`. Returns a reference to `rng2`.

###### Definition

Defined in the header file `boost/range/algorithm/swap_ranges.hpp`

###### Requirements

- `SinglePassRange1` is a model of the Single Pass Range Concept.
- `SinglePassRange1` is mutable.
- `SinglePassRange2` is a model of the Single Pass Range Concept.
- `SinglePassRange2` is mutable.

###### Complexity

Linear. Exactly `distance(rng1)` elements are swapped.