[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / algorithms / alg.modifying.operations / alg.swap / iter_swap.pass.cpp
blobb3a9f5fc259ef7f2df31a9130cd66bc6f9ffa8ce
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 //===----------------------------------------------------------------------===//
9 // <algorithm>
11 // template<Iterator Iter1, Iterator Iter2>
12 // requires HasSwap<Iter1::reference, Iter2::reference>
13 // void
14 // iter_swap(Iter1 a, Iter2 b);
16 #include <algorithm>
17 #include <cassert>
19 #include "test_macros.h"
21 #if TEST_STD_VER > 17
22 constexpr bool test_swap_constexpr()
24 int i = 1;
25 int j = 2;
26 std::iter_swap(&i, &j);
27 return i == 2 && j == 1;
29 #endif // TEST_STD_VER > 17
31 int main(int, char**)
33 int i = 1;
34 int j = 2;
35 std::iter_swap(&i, &j);
36 assert(i == 2);
37 assert(j == 1);
39 #if TEST_STD_VER > 17
40 static_assert(test_swap_constexpr());
41 #endif // TEST_STD_VER > 17
43 return 0;