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 // <array>
11
12 // template <class T, size_t N> void swap(array<T,N>& x, array<T,N>& y);
13
14 #include <array>
15 #include <cassert>
16
main()17 int main()
18 {
19 {
20 typedef double T;
21 typedef std::array<T, 3> C;
22 C c1 = {1, 2, 3.5};
23 C c2 = {4, 5, 6.5};
24 swap(c1, c2);
25 assert(c1.size() == 3);
26 assert(c1[0] == 4);
27 assert(c1[1] == 5);
28 assert(c1[2] == 6.5);
29 assert(c2.size() == 3);
30 assert(c2[0] == 1);
31 assert(c2[1] == 2);
32 assert(c2[2] == 3.5);
33 }
34 {
35 typedef double T;
36 typedef std::array<T, 0> C;
37 C c1 = {};
38 C c2 = {};
39 swap(c1, c2);
40 assert(c1.size() == 0);
41 assert(c2.size() == 0);
42 }
43 }
44