1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <array>
10 
11 // tuple_element<I, array<T, N> >::type
12 
13 #include <array>
14 #include <type_traits>
15 
16 template <class T>
17 void test()
18 {
19     {
20     typedef T Exp;
21     typedef std::array<T, 3> C;
22     static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
23     static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
24     static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
25     }
26     {
27     typedef T const Exp;
28     typedef std::array<T, 3> const C;
29     static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
30     static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
31     static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
32     }
33     {
34     typedef T volatile Exp;
35     typedef std::array<T, 3> volatile C;
36     static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
37     static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
38     static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
39     }
40     {
41     typedef T const volatile Exp;
42     typedef std::array<T, 3> const volatile C;
43     static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
44     static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
45     static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
46     }
47 }
48 
49 int main()
50 {
51     test<double>();
52     test<int>();
53 }
54