blob: 4b0a47f1372680b23481b4dfa49ba3144a6aa12f [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
3// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. 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
17int 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}