Created on 2024-05-23.00:00:00 last changed 3 months ago
Proposed resolution:
This wording is relative to N4981.
Modify [range.lazy.split.view] as indicated:
namespace std::ranges { template<auto> struct require-constant; // exposition only template<class R> concept tiny-range = // exposition only sized_range<R> && requires { typename require-constant<remove_reference_t<R>::size()>; } && (remove_reference_t<R>::size() <= 1); template<input_range V, forward_range Pattern> requires view<V> && view<Pattern> && indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> && (forward_range<V> || tiny-range<Pattern>) class lazy_split_view : public view_interface<lazy_split_view<V, Pattern>> { […] constexpr auto size() requires sized_range<V> && tiny-range<Pattern> && (Pattern::size() == 0) { return ranges::size(base_); } constexpr auto size() const requires sized_range<const V> && tiny-range<Pattern> && (Pattern::size() == 0) { return ranges::size(base_); } }; […] }
Modify [range.split.view] as indicated:
namespace std::ranges { template<forward_range V, forward_range Pattern> requires view<V> && view<Pattern> && indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> class split_view : public view_interface<split_view<V, Pattern>> { […] constexpr auto size() requires sized_range<V> && tiny-range<Pattern> && (Pattern::size() == 0) { return ranges::size(base_); } constexpr auto size() const requires sized_range<const V> && tiny-range<Pattern> && (Pattern::size() == 0) { return ranges::size(base_); } }; […] }
[ 2024-08-02; Reflector poll ]
Set priority to 4 after reflector poll. Set Status to SG9.
"Design change".
"tiny-range
should accept span<T, 0|1>
or ref_view<array<T, 0|1>>
,
see related paper p1419."
When the pattern range is empty, lazy_split_view will split each element into individual subranges, which means its size is equal to the size of the underlying range.
Since we already have a tiny-range that can determine whether the range is empty by its type, it seems valuable to provide a size for lazy_split_view in this case, given that we already specifically checked for it by Pattern::size() == 0 in inner-iterator::operator++().History | |||
---|---|---|---|
Date | User | Action | Args |
2024-08-02 21:52:03 | admin | set | messages: + msg14291 |
2024-08-02 21:52:03 | admin | set | status: new -> open |
2024-05-26 07:51:59 | admin | set | messages: + msg14158 |
2024-05-23 00:00:00 | admin | create |