types/tagged: prefer variadic alignas over explicit calculation

This reduces the scope for constant integral expression errors under GCC
9
This commit is contained in:
Danny Robson 2019-05-04 11:33:59 +10:00
parent 577d7f5887
commit 3c78e19c99

View File

@ -41,8 +41,6 @@ namespace cruft {
using first_t = cruft::tuple::type::nth_t<tuple_t,0>;
using tag_t = std::decay_t<decltype (first_t::tag)>;
static constexpr auto alignment = max (alignof (ValueT)...);
/// All child types should have identical tag types
static_assert ((std::is_same_v<tag_t, std::decay_t<decltype(ValueT::tag)>> && ...));
@ -121,7 +119,7 @@ namespace cruft {
tag_t m_tag;
/// The storage area for all desired types.
alignas (alignment) std::byte m_data[
alignas (alignof (ValueT)...) std::byte m_data[
cruft::max (sizeof (ValueT)...)
];
};