This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Forward triviality in variant
- From: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: Tim Shen <timshen at google dot com>, "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 1 Jun 2017 18:21:44 +0300
- Subject: Re: [Patch] Forward triviality in variant
- Authentication-results: sourceware.org; auth=none
- References: <CAG4ZjNnp4DQXpBEs7yu-MCrfUGfk+3x=KkPZqJiQ5WWt3awnvg@mail.gmail.com> <CAG4ZjNm1vWNAS8qytZaFV7DDdS3=fONkqjgUWUA4cY0ppsuaNg@mail.gmail.com> <20170601151302.GA10443@redhat.com>
On 1 June 2017 at 18:13, Jonathan Wakely <jwakely@redhat.com> wrote:
> On 30/05/17 02:16 -0700, Tim Shen via libstdc++ wrote:
>>
>> diff --git a/libstdc++-v3/include/std/variant
>> b/libstdc++-v3/include/std/variant
>> index b9824a5182c..f81b815af09 100644
>> --- a/libstdc++-v3/include/std/variant
>> +++ b/libstdc++-v3/include/std/variant
>> @@ -290,6 +290,53 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>> __ref_cast<_Tp>(__t));
>> }
>>
>> + template<typename... _Types>
>> + struct _Traits
>> + {
>> + static constexpr bool is_default_constructible_v =
>> + is_default_constructible_v<typename _Nth_type<0,
>> _Types...>::type>;
>> + static constexpr bool is_copy_constructible_v =
>> + __and_<is_copy_constructible<_Types>...>::value;
>> + static constexpr bool is_move_constructible_v =
>> + __and_<is_move_constructible<_Types>...>::value;
>> + static constexpr bool is_copy_assignable_v =
>> + is_copy_constructible_v && is_move_constructible_v
>> + && __and_<is_copy_assignable<_Types>...>::value;
>> + static constexpr bool is_move_assignable_v =
>> + is_move_constructible_v
>> + && __and_<is_move_assignable<_Types>...>::value;
>
>
> It seems strange to me that these ones end with _v but the following
> ones don't. Could we make them all have no _v suffix?
Seems to me worth considering to rather make all of them have a _v suffix. :)
>
>> + static constexpr bool is_dtor_trivial =
>> + __and_<is_trivially_destructible<_Types>...>::value;
They all seem to be shortcuts for something::value, so it seems to me
logical to have
them all be _v.