]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/integer_sequence/requirements/typedefs.cc
1 // { dg-do compile { target c++14 } }
3 // Copyright (C) 2013-2023 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
21 #include <type_traits>
24 using std::integer_sequence
;
25 using std::make_integer_sequence
;
26 using std::index_sequence
;
27 using std::make_index_sequence
;
28 using std::index_sequence_for
;
30 static_assert( is_same
<integer_sequence
<int>::value_type
, int>::value
,
33 static_assert( is_same
<integer_sequence
<short>::value_type
, short>::value
,
36 static_assert( is_same
<make_integer_sequence
<int, 0>,
37 integer_sequence
<int>>::value
,
38 "make empty int seq" );
40 static_assert( is_same
<make_integer_sequence
<int, 2>,
41 integer_sequence
<int, 0, 1>>::value
,
42 "make non-empty int seq" );
44 static_assert( is_same
<make_integer_sequence
<unsigned, 0>,
45 integer_sequence
<unsigned>>::value
,
46 "make empty unsigned seq" );
48 static_assert( is_same
<make_integer_sequence
<unsigned, 2>,
49 integer_sequence
<unsigned, 0, 1>>::value
,
50 "make non-empty unsigned seq" );
52 static_assert( is_same
<index_sequence
<0, 1>,
53 integer_sequence
<std::size_t, 0, 1>>::value
,
56 static_assert( is_same
<make_index_sequence
<2>, index_sequence
<0, 1>>::value
,
59 static_assert( is_same
<index_sequence_for
<char, int, void, double>,
60 index_sequence
<0, 1, 2, 3>>::value
,
61 "index_sequence_for" );