xref: /llvm-project/libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/iter_swap.pass.cpp (revision 57b08b0944046a6a57ee9b7b479181f548a5b9b4)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <algorithm>
10 
11 // template<Iterator Iter1, Iterator Iter2>
12 //   requires HasSwap<Iter1::reference, Iter2::reference>
13 //   void
14 //   iter_swap(Iter1 a, Iter2 b);
15 
16 #include <algorithm>
17 #include <cassert>
18 
19 int main()
20 {
21     int i = 1;
22     int j = 2;
23     std::iter_swap(&i, &j);
24     assert(i == 2);
25     assert(j == 1);
26 }
27