]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/integer_sequence/requirements/typedefs.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / integer_sequence / requirements / typedefs.cc
1 // { dg-do compile { target c++14 } }
2 //
3 // Copyright (C) 2013-2023 Free Software Foundation, Inc.
4 //
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)
9 // any later version.
10 //
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.
15 //
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/>.
19
20 #include <utility>
21 #include <type_traits>
22
23 using std::is_same;
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;
29
30 static_assert( is_same<integer_sequence<int>::value_type, int>::value,
31 "int value_type");
32
33 static_assert( is_same<integer_sequence<short>::value_type, short>::value,
34 "short value_type");
35
36 static_assert( is_same<make_integer_sequence<int, 0>,
37 integer_sequence<int>>::value,
38 "make empty int seq" );
39
40 static_assert( is_same<make_integer_sequence<int, 2>,
41 integer_sequence<int, 0, 1>>::value,
42 "make non-empty int seq" );
43
44 static_assert( is_same<make_integer_sequence<unsigned, 0>,
45 integer_sequence<unsigned>>::value,
46 "make empty unsigned seq" );
47
48 static_assert( is_same<make_integer_sequence<unsigned, 2>,
49 integer_sequence<unsigned, 0, 1>>::value,
50 "make non-empty unsigned seq" );
51
52 static_assert( is_same<index_sequence<0, 1>,
53 integer_sequence<std::size_t, 0, 1>>::value,
54 "index seq" );
55
56 static_assert( is_same<make_index_sequence<2>, index_sequence<0, 1>>::value,
57 "make index seq" );
58
59 static_assert( is_same<index_sequence_for<char, int, void, double>,
60 index_sequence<0, 1, 2, 3>>::value,
61 "index_sequence_for" );