From 809a8679a8b969f2dbed5d0fee3c96f2c0bbc9f5 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 9 Dec 2024 14:08:17 +0100 Subject: [PATCH] any/meta: cleanup --- src/entt/core/any.hpp | 4 +++- src/entt/meta/meta.hpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/entt/core/any.hpp b/src/entt/core/any.hpp index c6d419e8d..29fe81b63 100644 --- a/src/entt/core/any.hpp +++ b/src/entt/core/any.hpp @@ -176,9 +176,11 @@ public: * @tparam Type Type of object to use to initialize the wrapper. * @param value A pointer to an object to take ownership of. */ - template && !std::is_void_v>> + template explicit basic_any(std::in_place_t, Type *value) : instance{value} { + static_assert(!std::is_const_v && !std::is_void_v, "Non-const non-void pointer required"); + if(instance != nullptr) { initialize(*value); mode = any_policy::dynamic; diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index 3550d155a..a0bb62ce9 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -257,7 +257,7 @@ public: * @tparam Type Type of object to use to initialize the wrapper. * @param value A pointer to an object to take ownership of. */ - template && !std::is_void_v>> + template explicit meta_any(std::in_place_t, Type *value) : meta_any{locator::value_or(), std::in_place, value} {} @@ -267,7 +267,7 @@ public: * @param area The context from which to search for meta types. * @param value A pointer to an object to take ownership of. */ - template && !std::is_void_v>> + template explicit meta_any(const meta_ctx &area, std::in_place_t, Type *value) : storage{std::in_place, value}, ctx{&area} {