diff --git a/mpl/vector.hpp b/mpl/vector.hpp index bbf06858..9d60be45 100644 --- a/mpl/vector.hpp +++ b/mpl/vector.hpp @@ -33,7 +33,9 @@ namespace mpl::detail { } explicit vector(size_type size, uninitialized) - : size_{size}, data_{static_cast(operator new(size_ * sizeof(T)))} { + : size_{size}, + data_{static_cast(operator new(size_ * sizeof(T), + std::align_val_t{alignof(T)}))} { if (not std::is_trivially_copyable::value) for (size_type i{0}; i < size; ++i) new (&data_[i]) value_type(); @@ -41,7 +43,9 @@ namespace mpl::detail { template explicit vector(size_type size, IterT iter) - : size_{size}, data_{static_cast(operator new(size_ * sizeof(T)))} { + : size_{size}, + data_{static_cast(operator new(size_ * sizeof(T), + std::align_val_t{alignof(T)}))} { for (size_type i{0}; i < size; ++i) { new (&data_[i]) value_type(*iter); ++iter;