• 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 // UNSUPPORTED: c++98, c++03, c++11
11 // <utility>
12 
13 // template<class T, T... I>
14 // struct integer_sequence
15 // {
16 //     typedef T type;
17 //
18 //     static constexpr size_t size() noexcept;
19 // };
20 
21 #include <utility>
22 #include <type_traits>
23 #include <cstddef>
24 #include <cassert>
25 
main()26 int main()
27 {
28 //  Make a few of sequences
29     using int3    = std::integer_sequence<int, 3, 2, 1>;
30     using size1   = std::integer_sequence<std::size_t, 7>;
31     using ushort2 = std::integer_sequence<unsigned short, 4, 6>;
32     using bool0   = std::integer_sequence<bool>;
33 
34 //  Make sure they're what we expect
35     static_assert ( std::is_same<int3::value_type, int>::value, "int3 type wrong" );
36     static_assert ( int3::size() == 3, "int3 size wrong" );
37 
38     static_assert ( std::is_same<size1::value_type, std::size_t>::value, "size1 type wrong" );
39     static_assert ( size1::size() == 1, "size1 size wrong" );
40 
41     static_assert ( std::is_same<ushort2::value_type, unsigned short>::value, "ushort2 type wrong" );
42     static_assert ( ushort2::size() == 2, "ushort2 size wrong" );
43 
44     static_assert ( std::is_same<bool0::value_type, bool>::value, "bool0 type wrong" );
45     static_assert ( bool0::size() == 0, "bool0 size wrong" );
46 }
47