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

Implement ranges::subrange and ranges::view_interface #734

Merged
merged 4 commits into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
491 changes: 491 additions & 0 deletions stl/inc/xutility

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions tests/std/include/range_algorithm_support.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class move_only_range<T>::iterator {

public:
using iterator_concept = std::input_iterator_tag;
using iterator_category = std::output_iterator_tag;
using iterator_category = void; // TRANSITION, LWG-3289
using value_type = std::remove_cv_t<T>;
using difference_type = std::ptrdiff_t;
using pointer = void;
Expand Down Expand Up @@ -222,9 +222,6 @@ struct test_iterator {
STATIC_ASSERT(always_false<Category>);
}

friend void iter_move(test_iterator const&) {
STATIC_ASSERT(always_false<Category>);
}
friend void iter_swap(test_iterator const&, test_iterator const&) {
STATIC_ASSERT(always_false<Category>);
}
Expand Down
1 change: 1 addition & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ tests\P0896R4_ranges_alg_mismatch
tests\P0896R4_ranges_alg_none_of
tests\P0896R4_ranges_iterator_machinery
tests\P0896R4_ranges_range_machinery
tests\P0896R4_ranges_subrange
tests\P0896R4_ranges_to_address
tests\P0898R3_concepts
tests\P0898R3_identity
Expand Down
4 changes: 1 addition & 3 deletions tests/std/tests/P0896R4_ranges_algorithm_machinery/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ namespace indirectly_comparable_test {

namespace dangling_test {
// Also test borrowed_iterator_t and borrowed_subrange_t
using ranges::dangling, ranges::borrowed_iterator_t;
using ranges::dangling, ranges::borrowed_iterator_t, ranges::borrowed_subrange_t;
using std::is_nothrow_constructible_v, std::same_as;

STATIC_ASSERT(std::is_class_v<dangling>);
Expand All @@ -367,10 +367,8 @@ namespace dangling_test {
STATIC_ASSERT(same_as<borrowed_iterator_t<borrowed<false>>, dangling>);
STATIC_ASSERT(same_as<borrowed_iterator_t<borrowed<true>>, int*>);

#if 0 // TRANSITION, subrange
STATIC_ASSERT(same_as<borrowed_subrange_t<borrowed<false>>, dangling>);
STATIC_ASSERT(same_as<borrowed_subrange_t<borrowed<true>>, ranges::subrange<int*>>);
#endif // TRANSITION, subrange
} // namespace dangling_test

namespace result_test {
Expand Down
2 changes: 0 additions & 2 deletions tests/std/tests/P0896R4_ranges_range_machinery/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,9 +1503,7 @@ namespace borrowed_range_testing {
STATIC_ASSERT(test_borrowed_range<std::wstring_view, std::wstring_view::iterator>());
STATIC_ASSERT(test_borrowed_range<std::span<int>, std::span<int>::iterator>());
STATIC_ASSERT(test_borrowed_range<std::span<int, 42>, std::span<int, 42>::iterator>());
#if 0 // TRANSITION, subrange
STATIC_ASSERT(test_borrowed_range<ranges::subrange<int*, int*>, int*>());
#endif // TRANSITION, subrange
#if 0 // TRANSITION, future
STATIC_ASSERT(test_borrowed_range<ranges::ref_view<int[42]>, int*>());
STATIC_ASSERT(test_borrowed_range<ranges::iota_view<int, int>, ...>());
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/P0896R4_ranges_subrange/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 ..\concepts_matrix.lst
Loading