Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P2321R2: views::adjacent_transform, views::pairwise_transform #3546

Merged
merged 14 commits into from
Mar 17, 2023
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
394 changes: 390 additions & 4 deletions stl/inc/ranges

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@
// P2291R3 constexpr Integral <charconv>
// P2302R4 ranges::contains, ranges::contains_subrange
// P2321R2 zip
// (missing views::adjacent_transform)
// P2322R6 ranges::fold_left, ranges::fold_right, Etc.
// P2387R3 Pipe Support For User-Defined Range Adaptors
// P2404R3 Move-Only Types For Comparison Concepts
Expand Down Expand Up @@ -1739,6 +1738,7 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect
#define __cpp_lib_ranges_starts_ends_with 202106L
#define __cpp_lib_ranges_stride 202207L
#define __cpp_lib_ranges_to_container 202202L
#define __cpp_lib_ranges_zip 202110L
#endif // __cpp_lib_concepts

#define __cpp_lib_spanstream 202106L
Expand Down
4 changes: 0 additions & 4 deletions tests/libcxx/expected_results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,6 @@ std/utilities/format/format.tuple/parse.pass.cpp FAIL
std/utilities/format/format.tuple/set_brackets.pass.cpp FAIL
std/utilities/format/format.tuple/set_separator.pass.cpp FAIL

# P2321R2 zip
std/language.support/support.limits/support.limits.general/tuple.version.compile.pass.cpp FAIL
std/language.support/support.limits/support.limits.general/utility.version.compile.pass.cpp FAIL


# *** MISSING COMPILER FEATURES ***
# MSVC doesn't properly support [[no_unique_address]]
Expand Down
1 change: 1 addition & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ tests\P2302R4_ranges_alg_contains
tests\P2302R4_ranges_alg_contains_subrange
tests\P2321R2_proxy_reference
tests\P2321R2_views_adjacent
tests\P2321R2_views_adjacent_transform
tests\P2321R2_views_zip
tests\P2321R2_views_zip_transform
tests\P2322R6_ranges_alg_fold
Expand Down
28 changes: 10 additions & 18 deletions tests/std/tests/P2321R2_views_adjacent/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,15 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {

// Check view_interface::empty and operator bool
STATIC_ASSERT(CanMemberEmpty<R>);
STATIC_ASSERT(CanBool<R> == CanEmpty<R>);
if constexpr (CanMemberEmpty<R>) {
assert(r.empty() == is_empty);
assert(static_cast<bool>(r) == !is_empty);
}
STATIC_ASSERT(CanBool<R>);
assert(r.empty() == is_empty);
assert(static_cast<bool>(r) == !is_empty);

// Check view_interface::empty and operator bool (const)
STATIC_ASSERT(CanMemberEmpty<const R>);
STATIC_ASSERT(CanBool<const R> == CanEmpty<const R>);
if constexpr (CanMemberEmpty<const R>) {
assert(as_const(r).empty() == is_empty);
assert(static_cast<bool>(as_const(r)) == !is_empty);
}
STATIC_ASSERT(CanBool<const R>);
assert(as_const(r).empty() == is_empty);
assert(static_cast<bool>(as_const(r)) == !is_empty);

// Check content
assert(ranges::equal(r, expected));
Expand Down Expand Up @@ -306,16 +302,12 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
}

// Check view_interface::front
STATIC_ASSERT(CanMemberFront<R> == forward_range<V>);
if constexpr (CanMemberFront<R>) {
assert(r.front() == *begin(expected));
}
STATIC_ASSERT(CanMemberFront<R>);
assert(r.front() == *begin(expected));

// Check view_interface::front (const)
STATIC_ASSERT(CanMemberFront<const R> == forward_range<const V>);
if constexpr (CanMemberFront<const R>) {
assert(as_const(r).front() == *begin(expected));
}
STATIC_ASSERT(CanMemberFront<const R>);
assert(as_const(r).front() == *begin(expected));

// Check view_interface::back
STATIC_ASSERT(CanMemberBack<R> == (bidirectional_range<V> && common_range<V>) );
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/P2321R2_views_adjacent_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_latest_matrix.lst
Loading