Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
483 changes: 483 additions & 0 deletions stl/inc/ranges

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions tests/std/include/range_algorithm_support.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ namespace test {
STATIC_ASSERT(always_false<Category>);
}

friend void iter_swap(iterator const&, iterator const&) {
friend void iter_swap(iterator const&, iterator const&) requires std::is_same_v<Category, output> {
STATIC_ASSERT(always_false<Category>);
}

Expand All @@ -441,8 +441,9 @@ namespace test {
return std::move(*i.ptr_);
}

constexpr friend void iter_swap(iterator const& x, iterator const& y) requires at_least<input> {
ranges::iter_swap(x.ptr_, y.ptr_);
constexpr friend void iter_swap(iterator const& x, iterator const& y)
noexcept(std::is_nothrow_swappable_v<Element>) requires at_least<input> && std::swappable<Element> {
ranges::swap(*x.ptr_, *y.ptr_);
}

// forward iterator operations:
Expand Down Expand Up @@ -492,9 +493,14 @@ namespace test {
[[nodiscard]] constexpr boolish operator>=(iterator const& that) const noexcept requires at_least<random> {
return !(*this < that);
}
[[nodiscard]] constexpr auto operator<=>(iterator const& that) const noexcept requires at_least<random> {
return ptr_ <=> that.ptr_;
}

[[nodiscard]] constexpr ReferenceType operator[](ptrdiff_t const n) const& noexcept requires at_least<random> {
return ReferenceType{ptr_[n]};
}

constexpr iterator& operator+=(ptrdiff_t const n) & noexcept requires at_least<random> {
ptr_ += n;
return *this;
Expand All @@ -503,13 +509,15 @@ namespace test {
ptr_ -= n;
return *this;
}

[[nodiscard]] constexpr iterator operator+(ptrdiff_t const n) const noexcept requires at_least<random> {
return iterator{ptr_ + n};
}
[[nodiscard]] friend constexpr iterator operator+(ptrdiff_t const n, iterator const& i) noexcept
requires at_least<random> {
return i + n;
}

[[nodiscard]] constexpr iterator operator-(ptrdiff_t const n) const noexcept requires at_least<random> {
return iterator{ptr_ - n};
}
Expand Down
2 changes: 2 additions & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ tests\P0896R4_views_filter_death
tests\P0896R4_views_reverse
tests\P0896R4_views_single
tests\P0896R4_views_take
tests\P0896R4_views_transform
tests\P0896R4_views_transform_death
tests\P0898R3_concepts
tests\P0898R3_identity
tests\P0912R5_coroutine
Expand Down
1 change: 1 addition & 0 deletions tests/std/tests/P0896R4_ranges_range_machinery/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ STATIC_ASSERT(test_cpo(ranges::views::filter));
STATIC_ASSERT(test_cpo(ranges::views::reverse));
STATIC_ASSERT(test_cpo(ranges::views::single));
STATIC_ASSERT(test_cpo(ranges::views::take));
STATIC_ASSERT(test_cpo(ranges::views::transform));

void test_cpo_ambiguity() {
using namespace std::ranges;
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/P0896R4_views_transform/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\strict_concepts_matrix.lst
Loading