1 //===----------------------------------------------------------------------===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++03, c++11, c++14, c++17 10 11 // Test that iota_view conforms to range and view concepts. 12 13 #include <ranges> 14 15 #include "types.h" 16 17 struct Decrementable { 18 using difference_type = int; 19 20 auto operator<=>(const Decrementable&) const = default; 21 22 Decrementable& operator++(); 23 Decrementable operator++(int); 24 Decrementable& operator--(); 25 Decrementable operator--(int); 26 }; 27 28 struct Incrementable { 29 using difference_type = int; 30 31 auto operator<=>(const Incrementable&) const = default; 32 33 Incrementable& operator++(); 34 Incrementable operator++(int); 35 }; 36 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>>); 43