cplusplus / nbballot

Handling of NB comments in response to ballots
14 stars 4 forks source link

US292 24.07.10.2 Incorrect constructor for join_view::iterator LWG 3278 P1983 #288

Closed wg21bot closed 4 years ago

wg21bot commented 5 years ago

join_view::iterator's constructor is incorrect. In join_view<V>::iterator<Const>, we see the constructor:

  constexpr iterator(Parent& parent, iterator_t<V> outer)

V above is the non-const-qualified view template parameter. We will then try to initialize the outer_ data member with outer, which has type iterator_t<Base>, where Base is const V when Const is true, and V otherwise. This is broken; there is no required conversion if the types are different. Fixing this will probably require changes also to join_view's begin() and end() members.

Proposed change: In [range.join.view], change the joinview<V>::inner member to be mutable. This is safe because this exposition-only member is only used when the join_view is single-pass and only modified by operations that invalidate other iterators.

See https://cplusplus.github.io/LWG/issue3278

jwakely commented 5 years ago

The NB commenter's proposed change was incorrectly copied from #287 but should have been to change V to Base (see https://github.com/ericniebler/stl2/issues/573 for the equivalent change).

mclow commented 5 years ago

LWG Friday AM in Belfast. We think that the change should have been described as:

- constexpr iterator(Parent& parent, iterator_t<V> outer)
+ constexpr iterator(Parent& parent, iterator_t<Base> outer)
mclow commented 5 years ago

General agreement on direction; TS to write issue.

mclow commented 4 years ago

LWG Saturday PM in Belfast. Resolved by the adoption of P1983R0 in Prague.

jensmaurer commented 4 years ago

Accepted with modification. See paper P1983R0.