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> constexpr size_type array<T,N>::size();
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 c = {1, 2, 3.5};
23 assert(c.size() == 3);
24 assert(c.max_size() == 3);
25 assert(!c.empty());
26 }
27 {
28 typedef double T;
29 typedef std::array<T, 0> C;
30 C c = {};
31 assert(c.size() == 0);
32 assert(c.max_size() == 0);
33 assert(c.empty());
34 }
35 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
36 {
37 typedef double T;
38 typedef std::array<T, 3> C;
39 constexpr C c = {1, 2, 3.5};
40 static_assert(c.size() == 3, "");
41 static_assert(c.max_size() == 3, "");
42 static_assert(!c.empty(), "");
43 }
44 {
45 typedef double T;
46 typedef std::array<T, 0> C;
47 constexpr C c = {};
48 static_assert(c.size() == 0, "");
49 static_assert(c.max_size() == 0, "");
50 static_assert(c.empty(), "");
51 }
52 #endif
53 }
54