| Home | Libraries | People | FAQ | More

##### swap

###### Description

Performs an element by element swap of the elements in 2 sequences.

###### Synopsis

    template<typename Seq1, typename Seq2>
    void swap(Seq1& seq1, Seq2& seq2);

###### Parameters

Parameters | Requirement | Description
--- | --- | ---
`seq1`, `seq2` | Models of Forward Sequence | The sequences whos elements we wish to swap.

###### Expression Semantics

    swap(seq1, seq2);

Return type: `void`

Precondition: ``size`(seq1) == `size`(seq2)`

Semantics: Calls `swap(a1, b1)` for corresponding elements in `seq1` and `seq2`.

/sequence/intrinsic/swap.hpp>

###### Example

    vector<int, std::string> v1(1, "hello"), v2(2, "world");
    swap(v1, v2);
    assert(v1 == make_vector(2, "world"));
    assert(v2 == make_vector(1, "hello"));