aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/std/ranges/p2367.cc
blob: 3fc4a3f17e5faef64a8c94adc5606282d266db3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (C) 2021-2025 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3.  If not see
// <http://www.gnu.org/licenses/>.

// { dg-do compile { target c++20 } }

// Verify P2367 changes.

#include <ranges>

namespace ranges = std::ranges;
namespace views = std::views;

void
test01()
{
  extern int (&x)[5];

  // Verify changes to views::single.
  using ranges::single_view;
  using std::same_as;
  same_as<single_view<int*>> auto v1 = views::single(x);
  same_as<single_view<int>> auto v2 = views::single((const int)5);
  same_as<single_view<single_view<int>>> auto v3 = views::single(v2);

  // Verify changes to views::take.
  auto v4 = views::take(x, 0ull);

  // Verify changes to views::drop.
  auto v5 = views::drop(x, 0ull);

  // Verify changes to views::lazy_split.
  auto v6 = views::lazy_split(x, 5u);
  auto v7 = views::split(x, 5u);
}