diff --git a/shared/source/helpers/string.h b/shared/source/helpers/string.h index 37ec606f49..9c05063ba8 100644 --- a/shared/source/helpers/string.h +++ b/shared/source/helpers/string.h @@ -115,8 +115,11 @@ inline std::unique_ptr makeCopy(const void *src, size_t size) { if (size == 0) { return nullptr; } - using ElT = typename std::remove_all_extents::type; - std::unique_ptr copiedData(new ElT[size]); + + static_assert(sizeof(T) == 1u && std::is_trivially_copyable_v); + + auto copiedData = std::make_unique(size); memcpy_s(copiedData.get(), size, src, size); + return copiedData; }