1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // type_traits 11 12 // is_swappable 13 14 // IMPORTANT: The include order is part of the test. We want to pick up 15 // the following definitions in this order: 16 // 1) is_swappable, is_nothrow_swappable 17 // 2) iter_swap, swap_ranges 18 // 3) swap(T (&)[N], T (&)[N]) 19 // This test checks that (1) and (2) see forward declarations 20 // for (3). 21 #include <type_traits> 22 #include <algorithm> 23 #include <utility> 24 25 #include "test_macros.h" 26 27 int main() 28 { 29 // Use a builtin type so we don't get ADL lookup. 30 typedef double T[17][29]; 31 { 32 LIBCPP_STATIC_ASSERT(std::__is_swappable<T>::value, ""); 33 #if TEST_STD_VER > 14 34 static_assert(std::is_swappable_v<T>, ""); 35 #endif 36 } 37 { 38 T t1 = {}; 39 T t2 = {}; 40 std::iter_swap(t1, t2); 41 std::swap_ranges(t1, t1 + 17, t2); 42 } 43 } 44