public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ville Voutilainen <ville.voutilainen@gmail.com>
Cc: libstdc++ <libstdc++@gcc.gnu.org>,
	       "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [v3 PATCH] Implement std::is_aggregate.
Date: Sun, 02 Apr 2017 05:35:00 -0000	[thread overview]
Message-ID: <20170402053514.GZ17461@tucnak> (raw)
In-Reply-To: <CAFk2RUZzdhAD8gXMFGKL0KKKF1p9Pzr8=+dzBrCfH-astcSKYg@mail.gmail.com>

On Sun, Apr 02, 2017 at 01:18:58AM +0300, Ville Voutilainen wrote:
> Tested on Linux-x64.
> 
> 2017-04-02  Ville Voutilainen  <ville.voutilainen@gmail.com>
> 
>     Implement std::is_aggregate.
>     * include/std/type_traits (is_aggregate): New.
>     * testsuite/20_util/is_aggregate/requirements/explicit_instantiation.cc:
>     New.
>     * testsuite/20_util/is_aggregate/requirements/typedefs.cc: Likewise.
>     * testsuite/20_util/is_aggregate/value.cc: Likewise.
>
> diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> index 6707caa..89a3738 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -3062,6 +3062,25 @@ template <typename _From, typename _To>
>  #endif
>  #undef _GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP
>  
> +#ifdef __has_builtin
> +# if !__has_builtin(__is_aggregate)
> +// Try not to break non-GNU compilers that don't support the built-in:
> +#  define _GLIBCXX_NO_BUILTIN_IS_AGGREGATE 1
> +# endif
> +#endif
> +
> +#ifndef _GLIBCXX_NO_BUILTIN_IS_AGGREGATE
> +#define __cpp_lib_is_aggregate 201703
> +  /// is_aggregate
> +  template<typename _Tp>
> +    struct is_aggregate
> +    : bool_constant<__is_aggregate(
> +      remove_cv_t<_Tp>
> +      )>

Any reason for the wrapping?

> +    : bool_constant<__is_aggregate(remove_cv_t<_Tp>)>

Would fit on one line.

I admit I know next to nothing about libstdc++ code formatting.

> +    { };

Also, shouldn't there be also:

  /// is_aggregate_v
  template<typename _Tp>
    _GLIBCXX17_INLINE constexpr bool is_aggregate_v =
      is_aggregate<_Tp>::value;

somewhere with appropriate guards (or within the same ones)?

> +#endif
> +#undef _GLIBCXX_NO_BUILTIN_IS_AGGREGATE
> +  
>  #endif // C++17
>  
>  _GLIBCXX_END_NAMESPACE_VERSION

I'm surprised tests for the is_*_v variable templates are only in
experimental/type_traits/value.cc when they are now apparently
part of C++17.

	Jakub

  reply	other threads:[~2017-04-02  5:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-01 22:19 Ville Voutilainen
2017-04-02  5:35 ` Jakub Jelinek [this message]
2017-04-02  9:24   ` Ville Voutilainen
2017-04-02 11:08     ` Jakub Jelinek
2017-04-02 12:08       ` Ville Voutilainen
2017-04-03 15:32         ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170402053514.GZ17461@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=ville.voutilainen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).