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 | // <tuple> |
10 | |
11 | // template <class... Types> class tuple; |
12 | |
13 | // template <class... Types> |
14 | // class tuple_size<tuple<Types...>> |
15 | // : public integral_constant<size_t, sizeof...(Types)> { }; |
16 | |
17 | // UNSUPPORTED: c++03 |
18 | |
19 | #include <tuple> |
20 | #include <type_traits> |
21 | |
22 | #include "test_macros.h" |
23 | |
24 | template <class T, std::size_t N> |
25 | void test() |
26 | { |
27 | static_assert((std::is_base_of<std::integral_constant<std::size_t, N>, |
28 | std::tuple_size<T> >::value), "" ); |
29 | static_assert((std::is_base_of<std::integral_constant<std::size_t, N>, |
30 | std::tuple_size<const T> >::value), "" ); |
31 | static_assert((std::is_base_of<std::integral_constant<std::size_t, N>, |
32 | std::tuple_size<volatile T> >::value), "" ); |
33 | static_assert((std::is_base_of<std::integral_constant<std::size_t, N>, |
34 | std::tuple_size<const volatile T> >::value), "" ); |
35 | } |
36 | |
37 | int main(int, char**) |
38 | { |
39 | test<std::tuple<>, 0>(); |
40 | test<std::tuple<int>, 1>(); |
41 | test<std::tuple<char, int>, 2>(); |
42 | test<std::tuple<char, char*, int>, 3>(); |
43 | |
44 | return 0; |
45 | } |
46 | |