This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3 PATCH] Implement std::is_aggregate.


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]