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

Tim Song t.canens.cpp@gmail.com
Mon May 17 22:28:19 GMT 2021


On Mon, May 17, 2021 at 2:59 PM Patrick Palka <ppalka@redhat.com> 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 required to be a no-op, so we should still invalidate.


> +           {
> +             // Propagate the cached offset, but invalidate the source.
> +             this->_M_offset = __other._M_offset;
> +             __other._M_offset = -1;
> +           }
> +         return *this;
> +       }


More information about the Gcc-patches mailing list