From 4c3a35bc952e7780553ba2ac73e4baf3f2134ba3 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Tue, 3 Oct 2023 14:49:04 +0200 Subject: [PATCH] storage: make get_allocator work with void type --- src/entt/entity/storage.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index 6a76f5e3a..925e05865 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -841,7 +841,12 @@ public: * @return The associated allocator. */ [[nodiscard]] constexpr allocator_type get_allocator() const noexcept { - return allocator_type{base_type::get_allocator()}; + // std::allocator has no cross constructors (waiting for C++20) + if constexpr(std::is_same_v && !std::is_constructible_v) { + return allocator_type{}; + } else { + return allocator_type{base_type::get_allocator()}; + } } /**