From f63b6c07ca3e14758df1a815d71e90b971c8f6f5 Mon Sep 17 00:00:00 2001 From: Ben Deane Date: Thu, 12 Mar 2026 19:08:16 -0600 Subject: [PATCH] :bug: Fix `make_array` for zero-length cases Problem: - `make_array` doesn't work when given length zero. Solution: - Fix that. --- include/stdx/array.hpp | 6 ++++-- test/array.cpp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/include/stdx/array.hpp b/include/stdx/array.hpp index b0952de..15d358e 100644 --- a/include/stdx/array.hpp +++ b/include/stdx/array.hpp @@ -11,6 +11,8 @@ template constexpr auto make_array(Ts &&...ts) { if constexpr (not std::is_void_v) { return std::array{std::forward(ts)...}; + } else if constexpr (sizeof...(Ts) == 0) { + return std::array{}; } else { using A = std::common_type_t; return std::array{std::forward(ts)...}; @@ -19,7 +21,7 @@ constexpr auto make_array(Ts &&...ts) { template