This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3 PATCH] PR libstdc++/84601
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 6 Mar 2018 21:06:47 +0000
- Subject: Re: [v3 PATCH] PR libstdc++/84601
- Authentication-results: sourceware.org; auth=none
- References: <CAFk2RUZb44nxj3BgeWTRstdo5x4OVHb8HGK0_irK=MDq0zaWUg@mail.gmail.com> <CAFk2RUb0Zs+V-2TEpE=_vy4WCWjg33Nh21_Rq3b0RROuw6w71g@mail.gmail.com>
On 28/02/18 15:12 +0200, Ville Voutilainen wrote:
>- // Payload for constexpr optionals.
>+ // Payload for optionals with non-trivial destructor.
> template <typename _Tp,
> bool /*_HasTrivialDestructor*/ =
>- is_trivially_destructible<_Tp>::value>
>+ is_trivially_destructible<_Tp>::value,
>+ bool /*_HasTrivialCopyAssignment*/ =
>+ is_trivially_copy_assignable<_Tp>::value,
>+ bool /*_HasTrivialMoveAssignment*/ =
>+ is_trivially_move_assignable<_Tp>::value>
I'm not sure these comments are very useful, as they just repeat the
info that the traits already give us. Also, you could use the _v
variable templates if you wanted (doesn't make much difference
though).
But on the subject of redundant comments ...
> struct _Optional_payload
It took me a minute to figure out which conditions the primary
template gets used for, to double-check the comment. Would it be
helpful to use a comment like:
struct _Optional_payload // <false, _TrivialCopy, _TrivialMove>
or does that not really clarify anything?
I suppose it doesn't tell us any more than the "non-trivial
destructor" comment you already have.
So OK for trunk then.