Re: [PATCH] libstdc++: Fix iterator caching inside range adaptors [PR100479]

2021-05-24 Thread Jonathan Wakely via Gcc-patches
On 18/05/21 00:53 -0400, Patrick Palka via Libstdc++ wrote: On Mon, 17 May 2021, Tim Song wrote: On Mon, May 17, 2021 at 2:59 PM Patrick Palka wrote: > > + constexpr _CachedPosition& > + operator=(_CachedPosition&& __other) noexcept > + { > + if (std::__addressof(__ot

Re: [PATCH] libstdc++: Fix iterator caching inside range adaptors [PR100479]

2021-05-17 Thread Patrick Palka via Gcc-patches
On Mon, 17 May 2021, Tim Song wrote: > On Mon, May 17, 2021 at 2:59 PM Patrick Palka wrote: > > > > + constexpr _CachedPosition& > > + operator=(_CachedPosition&& __other) noexcept > > + { > > + if (std::__addressof(__other) != this) > > I don't think we need this check

Re: [PATCH] libstdc++: Fix iterator caching inside range adaptors [PR100479]

2021-05-17 Thread Tim Song via Gcc-patches
On Mon, May 17, 2021 at 2:59 PM Patrick Palka wrote: > > + constexpr _CachedPosition& > + operator=(_CachedPosition&& __other) noexcept > + { > + if (std::__addressof(__other) != this) I don't think we need this check - self-move-assigning the underlying view isn't requi

Re: [PATCH] libstdc++: Fix iterator caching inside range adaptors [PR100479]

2021-05-17 Thread Patrick Palka via Gcc-patches
On Mon, 17 May 2021, Tim Song wrote: > On Mon, May 17, 2021 at 11:46 AM Patrick Palka via Libstdc++ > wrote: > > constexpr void > > _M_set(const _Range&, const iterator_t<_Range>& __it) > > { > > __glibcxx_assert(!_M_has_value()); > > - _M_iter = __it; >

Re: [PATCH] libstdc++: Fix iterator caching inside range adaptors [PR100479]

2021-05-17 Thread Tim Song via Gcc-patches
On Mon, May 17, 2021 at 11:46 AM Patrick Palka via Libstdc++ wrote: > constexpr void > _M_set(const _Range&, const iterator_t<_Range>& __it) > { > __glibcxx_assert(!_M_has_value()); > - _M_iter = __it; > + this->_M_payload._M_payload._M_value = __i

Re: [PATCH] libstdc++: Fix iterator caching inside range adaptors [PR100479]

2021-05-17 Thread Jonathan Wakely via Gcc-patches
On 17/05/21 11:43 -0400, Patrick Palka via Libstdc++ wrote: This fixes two issues with our iterator caching as described in detail in the PR. Since r12-336 added the __non_propagating_cache class template as part of P2328, this patch just rewrites the _CachedPosition partial specialization in te