Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-10 Thread Jonathan Wakely
On 08/04/19 19:54 +0100, Jonathan Wakely wrote: On 08/04/19 17:36 +0100, Jonathan Wakely wrote: On 08/04/19 19:20 +0300, Ville Voutilainen wrote: On Mon, 8 Apr 2019 at 19:12, Ville Voutilainen wrote: On Mon, 8 Apr 2019 at 19:02, Jonathan Wakely wrote: The attached patch implements the same

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-08 Thread Jonathan Wakely
On 08/04/19 19:54 +0100, Jonathan Wakely wrote: On 08/04/19 17:36 +0100, Jonathan Wakely wrote: On 08/04/19 19:20 +0300, Ville Voutilainen wrote: On Mon, 8 Apr 2019 at 19:12, Ville Voutilainen wrote: On Mon, 8 Apr 2019 at 19:02, Jonathan Wakely wrote: The attached patch implements the same

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-08 Thread Jonathan Wakely
On 08/04/19 17:36 +0100, Jonathan Wakely wrote: On 08/04/19 19:20 +0300, Ville Voutilainen wrote: On Mon, 8 Apr 2019 at 19:12, Ville Voutilainen wrote: On Mon, 8 Apr 2019 at 19:02, Jonathan Wakely wrote: The attached patch implements the same thing with totally separate __gen_vtable_r and _

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-08 Thread Jonathan Wakely
On 08/04/19 19:20 +0300, Ville Voutilainen wrote: On Mon, 8 Apr 2019 at 19:12, Ville Voutilainen wrote: On Mon, 8 Apr 2019 at 19:02, Jonathan Wakely wrote: > The attached patch implements the same thing with totally separate > __gen_vtable_r and __gen_vtable_r_impl class templates, instead of

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-08 Thread Jonathan Wakely
On 08/04/19 17:02 +0100, Jonathan Wakely wrote: + template +struct __gen_vtable_r_impl< + _Multi_array<_Result_type (*)(_Visitor, _Variants...)>, + tuple<_Variants...>, std::index_sequence<__indices...>> +{ + using _Array_type = + _Multi_array<_Result_t

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-08 Thread Ville Voutilainen
On Mon, 8 Apr 2019 at 19:12, Ville Voutilainen wrote: > > On Mon, 8 Apr 2019 at 19:02, Jonathan Wakely wrote: > > The attached patch implements the same thing with totally separate > > __gen_vtable_r and __gen_vtable_r_impl class templates, instead of > > adding all the visit functionality into t

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-08 Thread Ville Voutilainen
On Mon, 8 Apr 2019 at 19:02, Jonathan Wakely wrote: > The attached patch implements the same thing with totally separate > __gen_vtable_r and __gen_vtable_r_impl class templates, instead of > adding all the visit functionality into the existing code (and then > needing to tease it apart again with

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-08 Thread Jonathan Wakely
On 06/04/19 03:07 +0300, Ville Voutilainen wrote: On Sat, 6 Apr 2019 at 02:55, Ville Voutilainen wrote: Just in case that cast looks scary: the implicit conversion is also deep down in __visit_invoke, so we do actually require implicit convertibility as we are supposed to. If that's still too

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-05 Thread Ville Voutilainen
On Sat, 6 Apr 2019 at 02:55, Ville Voutilainen wrote: > Just in case that cast looks scary: the implicit conversion is also > deep down in __visit_invoke, so > we do actually require implicit convertibility as we are supposed to. > If that's still too scary, > we can just do > > - return (_R

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-05 Thread Ville Voutilainen
On Sat, 6 Apr 2019 at 02:48, Ville Voutilainen wrote: > and > > - return __do_visit(std::forward<_Visitor>(__visitor), > - std::forward<_Variants>(__variants)...); > + return (_Res) > +__do_visit(std::forward<_Visitor>(__visitor), > + std::forward

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-05 Thread Ville Voutilainen
On Sat, 6 Apr 2019 at 02:19, Ville Voutilainen wrote: > And this patch fixes the existing visitation so that we don't > over-eagerly cast to void. The main gist of it is > > -else if constexpr (is_same_v<_Result_type, void>) > +else if constexpr (!__same_return_types && > +

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-05 Thread Ville Voutilainen
On Sat, 6 Apr 2019 at 01:55, Ville Voutilainen wrote: > > On Fri, 5 Apr 2019 at 23:29, Jonathan Wakely wrote: > > > > On 05/04/19 19:06 +0100, Jonathan Wakely wrote: > > > * doc/xml/manual/status_cxx2020.xml: Update status. > > > * include/std/variant (visit): Define for C++2a (P0655R

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-05 Thread Ville Voutilainen
On Fri, 5 Apr 2019 at 23:29, Jonathan Wakely wrote: > > On 05/04/19 19:06 +0100, Jonathan Wakely wrote: > > * doc/xml/manual/status_cxx2020.xml: Update status. > > * include/std/variant (visit): Define for C++2a (P0655R1). > > * testsuite/20_util/variant/visit_r.cc: New test. > >

Re: [PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-05 Thread Jonathan Wakely
On 05/04/19 19:06 +0100, Jonathan Wakely wrote: * doc/xml/manual/status_cxx2020.xml: Update status. * include/std/variant (visit): Define for C++2a (P0655R1). * testsuite/20_util/variant/visit_r.cc: New test. This implementation is wrong, the conversions to R need to hap

[PATCH] Implement std::visit for C++2a (P0655R1)

2019-04-05 Thread Jonathan Wakely
* doc/xml/manual/status_cxx2020.xml: Update status. * include/std/variant (visit): Define for C++2a (P0655R1). * testsuite/20_util/variant/visit_r.cc: New test. Tested powerpc64le-linux, committed to trunk. commit 60c01065cfdda4f93bd140b0ea37be16f537877c Author: Jonathan