From 561ccf600f109c0e83a75357ed6da51a4bf5e114 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 9 Dec 2019 09:40:57 +0100 Subject: [PATCH] util/AllocatedArray: remove bogus assertions `new T[0]` must not be nullptr. --- src/util/AllocatedArray.hxx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/util/AllocatedArray.hxx b/src/util/AllocatedArray.hxx index 21fe668ef..2ed856a18 100644 --- a/src/util/AllocatedArray.hxx +++ b/src/util/AllocatedArray.hxx @@ -58,9 +58,7 @@ public: constexpr AllocatedArray() = default; explicit AllocatedArray(size_type _size) noexcept - :buffer{new T[_size], _size} { - assert(size() == 0 || buffer.data != nullptr); - } + :buffer{new T[_size], _size} {} explicit AllocatedArray(const AllocatedArray &other) noexcept { assert(other.size() == 0 || other.buffer.data != nullptr); @@ -190,8 +188,6 @@ public: delete[] buffer.data; buffer.size = _size; buffer.data = new T[buffer.size]; - - assert(size() == 0 || buffer.data != nullptr); } /** @@ -213,7 +209,6 @@ public: return; T *new_data = new T[_size]; - assert(_size == 0 || new_data != nullptr); std::move(buffer.data, buffer.data + preserve, new_data);