xref: /llvm-project/libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/iter_swap.pass.cpp (revision 7fc6a55688c816f5fc1a5481ae7af25be7500356)
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 #include "test_macros.h"
20 
21 int main(int, char**)
22 {
23     int i = 1;
24     int j = 2;
25     std::iter_swap(&i, &j);
26     assert(i == 2);
27     assert(j == 1);
28 
29   return 0;
30 }
31