This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3 PATCH] Use single-visitation in variant assignment and swap.
- From: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 1 Apr 2019 11:43:00 +0300
- Subject: Re: [v3 PATCH] Use single-visitation in variant assignment and swap.
- References: <CAFk2RUZ-RvZyqWcUnyAHFRqc9VoPW9+qdWdXQCUGb5i5757wXQ@mail.gmail.com> <299d16ee-5b93-e3af-9e9b-bba04f4d5ff8@oracle.com>
On Mon, 1 Apr 2019 at 11:30, Paolo Carlini <paolo.carlini@oracle.com> wrote:
>
> Hi
>
> On 30/03/19 19:00, Ville Voutilainen wrote:
> > - template<typename _Visitor, typename... _Variants>
> > + template<bool __use_index, typename _Visitor, typename... _Variants>
> > + decltype(auto)
> > + __visitor_result_type(_Visitor&& __visitor, _Variants&&... __variants)
> > + {
> > + if constexpr(__use_index)
> > + return __detail::__variant::__variant_idx_cookie{};
> > + else
> > + return std::forward<_Visitor>(__visitor)(
> > + std::get<0>(std::forward<_Variants>(__variants))...);
> > + }
>
> If I'm not misreading something, the new function will be usually
> compiled/optimized to something very small and isn't constexpr thus
> normally should be explicitly marked inline. Or the problem is the
> missing constexpr? (sorry, I didn't really study the new code)
The only use of this function is to compute its return type. It's
never called. I should probably comment on that...