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 // UNSUPPORTED: c++98, c++03, c++11 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 <cstddef> 23 #include <cassert> 24 25 int main(int, char**) 26 { 27 // Make a few of sequences 28 using int3 = std::integer_sequence<int, 3, 2, 1>; 29 using size1 = std::integer_sequence<std::size_t, 7>; 30 using ushort2 = std::integer_sequence<unsigned short, 4, 6>; 31 using bool0 = std::integer_sequence<bool>; 32 33 // Make sure they're what we expect 34 static_assert ( std::is_same<int3::value_type, int>::value, "int3 type wrong" ); 35 static_assert ( int3::size() == 3, "int3 size wrong" ); 36 37 static_assert ( std::is_same<size1::value_type, std::size_t>::value, "size1 type wrong" ); 38 static_assert ( size1::size() == 1, "size1 size wrong" ); 39 40 static_assert ( std::is_same<ushort2::value_type, unsigned short>::value, "ushort2 type wrong" ); 41 static_assert ( ushort2::size() == 2, "ushort2 size wrong" ); 42 43 static_assert ( std::is_same<bool0::value_type, bool>::value, "bool0 type wrong" ); 44 static_assert ( bool0::size() == 0, "bool0 size wrong" ); 45 46 return 0; 47 } 48