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 // <utility>
11 
12 // template<class T, T... I>
13 // struct integer_sequence
14 // {
15 //     typedef T type;
16 //
17 //     static constexpr size_t size() noexcept;
18 // };
19 
20 #include <utility>
21 #include <type_traits>
22 #include <cassert>
23 
main()24 int main()
25 {
26 #if _LIBCPP_STD_VER > 11
27 
28 //  Make a few of sequences
29     using int3    = std::integer_sequence<int, 3, 2, 1>;
30     using size1   = std::integer_sequence<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, 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 #endif  // _LIBCPP_STD_VER > 11
48 }
49