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