1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // Test that iota_view conforms to range and view concepts.
17 struct Decrementable
{
18 using difference_type
= int;
20 auto operator<=>(const Decrementable
&) const = default;
22 Decrementable
& operator++();
23 Decrementable
operator++(int);
24 Decrementable
& operator--();
25 Decrementable
operator--(int);
28 struct Incrementable
{
29 using difference_type
= int;
31 auto operator<=>(const Incrementable
&) const = default;
33 Incrementable
& operator++();
34 Incrementable
operator++(int);
37 static_assert(std::ranges::random_access_range
<std::ranges::iota_view
<int>>);
38 static_assert(std::ranges::random_access_range
<const std::ranges::iota_view
<int>>);
39 static_assert(std::ranges::bidirectional_range
<std::ranges::iota_view
<Decrementable
>>);
40 static_assert(std::ranges::forward_range
<std::ranges::iota_view
<Incrementable
>>);
41 static_assert(std::ranges::input_range
<std::ranges::iota_view
<NotIncrementable
>>);
42 static_assert(std::ranges::view
<std::ranges::iota_view
<int>>);