diff --git a/include/rfl/Tuple.hpp b/include/rfl/Tuple.hpp index c08a4c03..ee12e54c 100644 --- a/include/rfl/Tuple.hpp +++ b/include/rfl/Tuple.hpp @@ -36,7 +36,7 @@ class Tuple { static constexpr unsigned int num_bytes_ = std::get(positions_); - using DataType = std::array; + using DataType = unsigned char[num_bytes_]; public: /// Constructs a Tuple by copying from the provided arguments. @@ -68,7 +68,7 @@ class Tuple { template constexpr auto& get() { using Type = internal::nth_element_t<_index, Types...>; - return *internal::ptr_cast(data_.data() + pos<_index>()); + return *internal::ptr_cast(data_ + pos<_index>()); } /// Gets an element by index (const). @@ -77,7 +77,7 @@ class Tuple { template constexpr const auto& get() const { using Type = internal::nth_element_t<_index, Types...>; - return *internal::ptr_cast(data_.data() + pos<_index>()); + return *internal::ptr_cast(data_ + pos<_index>()); } /// Copy assignment operator. Assigns from another Tuple by copy. @@ -157,7 +157,7 @@ class Tuple { const auto copy_one = [this](const auto& _other, std::integral_constant) { using Type = internal::nth_element_t<_i, Types...>; - ::new (static_cast(data_.data() + pos<_i>())) + ::new (static_cast(data_ + pos<_i>())) Type(_other.template get<_i>()); }; (copy_one(_other, std::integral_constant{}), ...); @@ -172,7 +172,7 @@ class Tuple { const auto copy_one = [this](const auto& _t, std::integral_constant) { using Type = internal::nth_element_t<_i, Types...>; - ::new (static_cast(data_.data() + pos<_i>())) Type(_t); + ::new (static_cast(data_ + pos<_i>())) Type(_t); }; (copy_one(_types, std::integral_constant{}), ...); } @@ -198,7 +198,7 @@ class Tuple { const auto move_one = [this](auto&& _other, std::integral_constant) { using Type = internal::nth_element_t<_i, Types...>; - ::new (static_cast(data_.data() + pos<_i>())) + ::new (static_cast(data_ + pos<_i>())) Type(std::move(_other.template get<_i>())); }; (move_one(_other, std::integral_constant{}), ...); @@ -212,7 +212,7 @@ class Tuple { const auto move_one = [this](auto&& _t, std::integral_constant) { using Type = internal::nth_element_t<_i, Types...>; - ::new (static_cast(data_.data() + pos<_i>())) Type(std::move(_t)); + ::new (static_cast(data_ + pos<_i>())) Type(std::move(_t)); }; (move_one(std::move(_types), std::integral_constant{}), ...); }