From bfd9323d4a1253dc32be5720e769d22b40712135 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 15 Dec 2023 22:13:36 -0800 Subject: Mark constructors noexcept as needed --- common/flexarray.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/flexarray.h b/common/flexarray.h index ad15d554..9b6fcc63 100644 --- a/common/flexarray.h +++ b/common/flexarray.h @@ -20,7 +20,9 @@ struct FlexArrayStorage { static constexpr size_t Sizeof(size_t count, size_t base=0u) noexcept { return sizeof(FlexArrayStorage) + sizeof(T)*count + base; } - FlexArrayStorage(size_t size) : mData{::new(static_cast(this+1)) T[size], size} { } + FlexArrayStorage(size_t size) noexcept(std::is_nothrow_constructible_v) + : mData{::new(static_cast(this+1)) T[size], size} + { } ~FlexArrayStorage() = default; FlexArrayStorage(const FlexArrayStorage&) = delete; @@ -34,7 +36,9 @@ struct FlexArrayStorage { static constexpr size_t Sizeof(size_t count, size_t base=0u) noexcept { return sizeof(FlexArrayStorage) + sizeof(T)*count + base; } - FlexArrayStorage(size_t size) : mData{::new(static_cast(this+1)) T[size], size} { } + FlexArrayStorage(size_t size) noexcept(std::is_nothrow_constructible_v) + : mData{::new(static_cast(this+1)) T[size], size} + { } ~FlexArrayStorage() { std::destroy(mData.begin(), mData.end()); } FlexArrayStorage(const FlexArrayStorage&) = delete; @@ -83,7 +87,9 @@ struct FlexArray { throw std::bad_alloc(); } - FlexArray(index_type size) noexcept(noexcept(Storage_t_{size})) : mStore{size} { } + FlexArray(index_type size) noexcept(std::is_nothrow_constructible_v) + : mStore{size} + { } ~FlexArray() = default; [[nodiscard]] auto size() const noexcept -> index_type { return mStore.mData.size(); } -- cgit v1.2.3