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

2019-04-01 Thread Jonathan Wakely
On 01/04/19 12:52 +0300, Ville Voutilainen wrote: On Mon, 1 Apr 2019 at 11:45, Ville Voutilainen wrote: On Sat, 30 Mar 2019 at 20:00, Ville Voutilainen wrote: > > This patch makes assignments correct, because they need to > match indices instead of types. In addition, we cut down the > codege

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

2019-04-01 Thread Jonathan Wakely
On 01/04/19 11:45 +0300, Ville Voutilainen wrote: @@ -570,45 +574,44 @@ namespace __variant operator=(const _Copy_assign_base& __rhs) noexcept(_Traits<_Types...>::_S_nothrow_copy_assign) { - __do_visit([this, &__rhs](auto&& __this_mem, auto&& __rhs_mem) mutable -

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

2019-04-01 Thread Ville Voutilainen
On Mon, 1 Apr 2019 at 11:45, Ville Voutilainen wrote: > > On Sat, 30 Mar 2019 at 20:00, Ville Voutilainen > wrote: > > > > This patch makes assignments correct, because they need to > > match indices instead of types. In addition, we cut down the > > codegen size. The symbols are longer than befo

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

2019-04-01 Thread Ville Voutilainen
On Mon, 1 Apr 2019 at 11:50, Ville Voutilainen wrote: > in it makes it trivial and I don't > need to worry about the validity of the branch taken, since it's not > instantiated. This is a new I mean the branch *not* taken. :)

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

2019-04-01 Thread Ville Voutilainen
On Mon, 1 Apr 2019 at 11:45, Paolo Carlini wrote: > >>> +__visitor_result_type(_Visitor&& __visitor, _Variants&&... > >>> __variants) > >>> +{ > >>> + if constexpr(__use_index) > >>> +return __detail::__variant::__variant_idx_cookie{}; > >>> + else > >>> + return std

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

2019-04-01 Thread Ville Voutilainen
On Sat, 30 Mar 2019 at 20:00, Ville Voutilainen wrote: > > This patch makes assignments correct, because they need to > match indices instead of types. In addition, we cut down the > codegen size. The symbols are longer than before, the the amount > of them is roughly the same, so there's no longe

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

2019-04-01 Thread Paolo Carlini
Hi On 01/04/19 10:43, Ville Voutilainen wrote: On Mon, 1 Apr 2019 at 11:30, Paolo Carlini wrote: Hi On 30/03/19 19:00, Ville Voutilainen wrote: - template + template +decltype(auto) +__visitor_result_type(_Visitor&& __visitor, _Variants&&... __variants) +{ + if constexpr(_

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

2019-04-01 Thread Ville Voutilainen
On Mon, 1 Apr 2019 at 11:30, Paolo Carlini wrote: > > Hi > > On 30/03/19 19:00, Ville Voutilainen wrote: > > - template > > + template > > +decltype(auto) > > +__visitor_result_type(_Visitor&& __visitor, _Variants&&... __variants) > > +{ > > + if constexpr(__use_index) > > +

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

2019-04-01 Thread Paolo Carlini
Hi On 30/03/19 19:00, Ville Voutilainen wrote: - template + template +decltype(auto) +__visitor_result_type(_Visitor&& __visitor, _Variants&&... __variants) +{ + if constexpr(__use_index) +return __detail::__variant::__variant_idx_cookie{}; + else + return s

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

2019-03-30 Thread Ville Voutilainen
This patch makes assignments correct, because they need to match indices instead of types. In addition, we cut down the codegen size. The symbols are longer than before, the the amount of them is roughly the same, so there's no longer an explosion in their amount. Relops are the last bit in these