This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3 PATCH] Implement std::is_aggregate.
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, libstdc++ <libstdc++ at gcc dot gnu dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 3 Apr 2017 16:32:51 +0100
- Subject: Re: [v3 PATCH] Implement std::is_aggregate.
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jwakely at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3C94FC059730
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3C94FC059730
- References: <CAFk2RUZzdhAD8gXMFGKL0KKKF1p9Pzr8=+dzBrCfH-astcSKYg@mail.gmail.com> <20170402053514.GZ17461@tucnak> <CAFk2RUbHjgrbYe_EZdjggweS0c=VkC1AGK5NCgh4SosHczVFJA@mail.gmail.com> <20170402110805.GA17461@tucnak> <CAFk2RUboedcV6x3oFu-URzafayiw3aQW1VG1ru=845P11efDqg@mail.gmail.com>
On 02/04/17 15:08 +0300, Ville Voutilainen wrote:
Implement std::is_aggregate.
* include/std/type_traits (is_aggregate, is_aggregate_v): 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..a5e7048 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>)> { };
Blank line here please.
+ /// is_aggregate_v
+ template<typename _Tp>
+ inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value;
+#endif
+#undef _GLIBCXX_NO_BUILTIN_IS_AGGREGATE
+
#endif // C++17
OK for trunk, thanks.