This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [PATCH 2/2] libstdc++: Add std::aligned_union.


On 16/04/14 17:06 +0200, Rüdiger Sonderfeld wrote:
C++11: [meta.trans.other]

* libstdc++-v3/testsuite/20_util/aligned_union/1.cc: New file.
* libstdc++-v3/include/std/type_traits (__strictest_alignment): New
 helper struct.
 (aligned_union): New struct (C++11).
 (aligned_union_t): New type alias (C++14).

Thanks! I was hoping to implement it the straightforward way, but was
thwarted by http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59012


+  template <typename... _Types>
+    struct __strictest_alignment
+    {
+      static const size_t _M_alignment = 0;
+      static const size_t _M_size = 0;

The naming convention is to use _S_xxx for static members

+  template <size_t Len, class... Types>
+    using aligned_union_t = typename aligned_union<Len,Types...>::type;

It should be s/class/typename/ here.

Is <initializer_list> needed for the testcase?

The testcase can use { dg-do compile } to turn it into a compile-only
test, and then doesn't need a main() function.

Otherwise I think this looks good, thanks.


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