Skip to content

Commit

Permalink
Added 3/4 of requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AnabelSMRuggiero committed Nov 22, 2021
1 parent bd56ca1 commit c702ec9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions stl/inc/ranges
Expand Up @@ -3042,10 +3042,11 @@ namespace ranges {
/* [[no_unique_address]] */ _Non_propagating_cache<_Cache_wrapper, false> _Inner{};
};

// clang-format off

template <class _Rng> // TRANSITION, LLVM-47414
concept _Can_const_join = input_range<const _Rng> && is_reference_v<range_reference_t<_Maybe_const<true, _Rng>>>;
concept _Can_const_join = input_range<const _Rng> && is_reference_v<range_reference_t<const _Rng>>;

// clang-format off
template <class _Vw>
requires is_reference_v<range_reference_t<_Vw>>
class _Join_view_base<_Vw> : public view_interface<join_view<_Vw>> {};
Expand Down
8 changes: 8 additions & 0 deletions tests/std/tests/P0896R4_views_join/test.cpp
Expand Up @@ -561,6 +561,14 @@ int main() {
static_assert(ranges::distance(views::iota(0, 2) | views::transform(ToArrayOfImmovable) | views::join) == 6);
}

{ // Joining a non-const view without const qualified begin and end methods
vector<vector<size_t>> nested_vectors = {{0}, {1, 2, 3}, {99}, {4, 5, 6, 7}, {}, {8, 9, 10}};
auto RemoveSmallVectors = [](const vector<size_t>& inner_vector) { return inner_vector.size() > 2; };
auto filted_and_joined = nested_vectors | views::filter(RemoveSmallVectors) | views::join;
static constexpr int result[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
assert(ranges::equal(filted_and_joined, result));
}

STATIC_ASSERT(instantiation_test());
instantiation_test();
}

0 comments on commit c702ec9

Please sign in to comment.