This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3 PATCH] Use single-visitation in variant assignment and swap.


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...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]