• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <tuple>
19 #include <type_traits>
20 
21 template <class T, std::size_t N>
test()22 void test()
23 {
24     static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
25                                    std::tuple_size<T> >::value), "");
26     static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
27                                    std::tuple_size<const T> >::value), "");
28     static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
29                                    std::tuple_size<volatile T> >::value), "");
30     static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
31                                    std::tuple_size<const volatile T> >::value), "");
32 }
33 
main()34 int main()
35 {
36     test<std::tuple<>, 0>();
37     test<std::tuple<int>, 1>();
38     test<std::tuple<char, int>, 2>();
39     test<std::tuple<char, char*, int>, 3>();
40 }
41