rstl::reserved_vector: constexpr constructors

This commit is contained in:
Luke Street 2020-05-09 18:36:57 -04:00
parent e8ce4c2e27
commit 977912a1be
1 changed files with 2 additions and 2 deletions

View File

@ -270,10 +270,10 @@ private:
destroy(Tp& t, std::enable_if_t<!std::is_destructible_v<Tp> || std::is_trivially_destructible_v<Tp>>* = nullptr) {} destroy(Tp& t, std::enable_if_t<!std::is_destructible_v<Tp> || std::is_trivially_destructible_v<Tp>>* = nullptr) {}
public: public:
reserved_vector() noexcept(std::is_nothrow_constructible_v<T>) : x0_size(0) {} constexpr reserved_vector() noexcept(std::is_nothrow_constructible_v<T>) : x0_size(0) {}
template <size_t LN> template <size_t LN>
reserved_vector(const T (&l)[LN]) noexcept(std::is_nothrow_copy_constructible_v<T>) : x0_size(LN) { constexpr reserved_vector(const T (&l)[LN]) noexcept(std::is_nothrow_copy_constructible_v<T>) : x0_size(LN) {
static_assert(LN <= N, "initializer array too large for reserved_vector"); static_assert(LN <= N, "initializer array too large for reserved_vector");
for (size_t i = 0; i < LN; ++i) { for (size_t i = 0; i < LN; ++i) {
::new (static_cast<void*>(std::addressof(_value(i)))) T(l[i]); ::new (static_cast<void*>(std::addressof(_value(i)))) T(l[i]);