Created on 2024-03-23.00:00:00 last changed 3 months ago
Proposed resolution:
This wording is relative to N4988.
Modify [range.join.with.iterator] as indicated:
constexpr iterator(iterator<!Const> i) requires Const && convertible_to<iterator_t<V>, OuterIter> && convertible_to<iterator_t<InnerRng>, InnerIter> && convertible_to<iterator_t<Pattern>, PatternIter>;-?- Preconditions: inner_it_.valueless_by_exception() is false.
-10- Effects: […]constexpr decltype(auto) operator*() const;-?- Preconditions: inner_it_.valueless_by_exception() is false.
-12- Effects: Equivalent to: […]constexpr iterator& operator++();-?- Preconditions: inner_it_.valueless_by_exception() is false.
-13- Effects: Equivalent to: […]constexpr void operator++(int);-?- Preconditions: inner_it_.valueless_by_exception() is false.
-14- Effects: Equivalent to: ++*this.constexpr iterator operator++(int) requires ref-is-glvalue && forward_iterator<OuterIter> && forward_iterator<InnerIter>;-?- Preconditions: inner_it_.valueless_by_exception() is false.
-15- Effects: Equivalent to: […]constexpr iterator& operator--() requires ref-is-glvalue && bidirectional_range<Base> && bidirectional-common<InnerBase> && bidirectional-common<PatternBase>;-?- Preconditions: inner_it_.valueless_by_exception() is false.
-16- Effects: Equivalent to: […]
[ 2024-08-08, Inbal Levi provides wording ]
[ 2024-06-24; Reflector poll ]
Set priority to 3 after reflector poll. We like the suggestion to require "not valueless" as a precondition.
join_with_view's iterator is defined in terms of variant, visit and get, which implies that the iterator operations throw bad_variant_access if the underlying variant is valueless-by-exception (which can happen if an underlying iterator has a throwing copy constructor).
IMO, the variant is an implementation detail and shouldn't be exposed. It's confusing for users to get bad_variant_access when user code does not deal with variant. The spec of join_with_view is also inconsistent with concat_view as recently added to the working draft by P2542R8. The latter has "it_.valueless_by_exception() is false" as a precondition. I believe that join_with_view should similarly require that inner_it_.valueless_by_exception() is false for each iterator operation. (FWIW, MSVC STL implements join_with_view with a trimmed-down version of variant, and having to throw bad_variant_access causes a small maintenance burden.)History | |||
---|---|---|---|
Date | User | Action | Args |
2024-08-10 17:41:28 | admin | set | messages: + msg14318 |
2024-08-10 17:41:28 | admin | set | messages: + msg14317 |
2024-06-24 12:09:57 | admin | set | messages: + msg14180 |
2024-03-23 00:00:00 | admin | create |