]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/std/ranges/refinements.cc
1 // Copyright (C) 2019-2020 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-options "-std=gnu++2a" }
19 // { dg-do compile { target c++2a } }
22 #include <testsuite_iterators.h>
24 static_assert( std::ranges::output_range
<int(&)[1], int> );
25 static_assert( ! std::ranges::output_range
<const int(&)[1], int> );
26 static_assert( std::ranges::output_range
<int[1], int> );
27 static_assert( ! std::ranges::output_range
<int[1], int*> );
29 static_assert( std::ranges::input_range
<int(&)[1]> );
30 static_assert( std::ranges::input_range
<const int(&)[1]> );
31 static_assert( std::ranges::input_range
<int[1]> );
33 static_assert( std::ranges::contiguous_range
<int(&)[1]> );
34 static_assert( std::ranges::contiguous_range
<const int(&)[1]> );
35 static_assert( std::ranges::contiguous_range
<int[1]> );
37 using namespace __gnu_test
;
39 static_assert( std::ranges::output_range
<test_contiguous_range
<int>, int> );
40 static_assert( std::ranges::output_range
<test_random_access_range
<int>, int> );
41 static_assert( std::ranges::output_range
<test_bidirectional_range
<int>, int> );
42 static_assert( std::ranges::output_range
<test_forward_range
<int>, int> );
43 static_assert( ! std::ranges::output_range
<test_input_range
<int>, int> );
44 static_assert( std::ranges::output_range
<test_output_range
<int>, int> );
46 static_assert( std::ranges::input_range
<test_contiguous_range
<int>> );
47 static_assert( std::ranges::input_range
<test_random_access_range
<int>> );
48 static_assert( std::ranges::input_range
<test_bidirectional_range
<int>> );
49 static_assert( std::ranges::input_range
<test_forward_range
<int>> );
50 static_assert( std::ranges::input_range
<test_input_range
<int>> );
51 static_assert( ! std::ranges::input_range
<test_output_range
<int>> );
53 static_assert( std::ranges::forward_range
<test_contiguous_range
<int>> );
54 static_assert( std::ranges::forward_range
<test_random_access_range
<int>> );
55 static_assert( std::ranges::forward_range
<test_bidirectional_range
<int>> );
56 static_assert( std::ranges::forward_range
<test_forward_range
<int>> );
57 static_assert( ! std::ranges::forward_range
<test_input_range
<int>> );
58 static_assert( ! std::ranges::forward_range
<test_output_range
<int>> );
60 static_assert( std::ranges::bidirectional_range
<test_contiguous_range
<int>> );
61 static_assert( std::ranges::bidirectional_range
<test_random_access_range
<int>>);
62 static_assert( std::ranges::bidirectional_range
<test_bidirectional_range
<int>>);
63 static_assert( ! std::ranges::bidirectional_range
<test_forward_range
<int>> );
64 static_assert( ! std::ranges::bidirectional_range
<test_input_range
<int>> );
65 static_assert( ! std::ranges::bidirectional_range
<test_output_range
<int>> );
67 static_assert( std::ranges::random_access_range
<test_contiguous_range
<int>> );
68 static_assert( std::ranges::random_access_range
<test_random_access_range
<int>>);
69 static_assert( ! std::ranges::random_access_range
<test_bidirectional_range
<int>>);
70 static_assert( ! std::ranges::random_access_range
<test_forward_range
<int>> );
71 static_assert( ! std::ranges::random_access_range
<test_input_range
<int>> );
72 static_assert( ! std::ranges::random_access_range
<test_output_range
<int>> );
74 static_assert( std::ranges::contiguous_range
<test_contiguous_range
<int>> );
75 static_assert( ! std::ranges::contiguous_range
<test_random_access_range
<int>>);
76 static_assert( ! std::ranges::contiguous_range
<test_bidirectional_range
<int>>);
77 static_assert( ! std::ranges::contiguous_range
<test_forward_range
<int>> );
78 static_assert( ! std::ranges::contiguous_range
<test_input_range
<int>> );
79 static_assert( ! std::ranges::contiguous_range
<test_output_range
<int>> );