xref: /minix3/external/bsd/libc++/dist/libcxx/test/containers/sequences/array/array.tuple/get_const.pass.cpp (revision 4684ddb6aab0b36791c8099bc705d6140b3d05d0)
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 <size_t I, class T, size_t N> const T& get(const array<T, N>& a);
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         const C c = {1, 2, 3.5};
23         assert(std::get<0>(c) == 1);
24         assert(std::get<1>(c) == 2);
25         assert(std::get<2>(c) == 3.5);
26     }
27 #if _LIBCPP_STD_VER > 11
28     {
29         typedef double T;
30         typedef std::array<T, 3> C;
31         constexpr const C c = {1, 2, 3.5};
32         static_assert(std::get<0>(c) == 1, "");
33         static_assert(std::get<1>(c) == 2, "");
34         static_assert(std::get<2>(c) == 3.5, "");
35     }
36 #endif
37 }
38