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#include "test_macros.h"
17
18template <class T>
19void test() {
20 {
21 typedef T Exp;
22 typedef std::array<T, 3> C;
23 static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
24 static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
25 static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
26 }
27 {
28 typedef T const Exp;
29 typedef std::array<T, 3> const C;
30 static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
31 static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
32 static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
33 }
34 {
35 typedef T volatile Exp;
36 typedef std::array<T, 3> volatile C;
37 static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
38 static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
39 static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
40 }
41 {
42 typedef T const volatile Exp;
43 typedef std::array<T, 3> const volatile C;
44 static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
45 static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
46 static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
47 }
48}
49
50int main(int, char**) {
51 test<double>();
52 test<int>();
53
54 return 0;
55}
56

source code of libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp