Browse Source

any/meta: cleanup

Michele Caini 1 year ago
parent
commit
809a8679a8
2 changed files with 5 additions and 3 deletions
  1. 3 1
      src/entt/core/any.hpp
  2. 2 2
      src/entt/meta/meta.hpp

+ 3 - 1
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<typename Type, typename = std::enable_if_t<!std::is_const_v<Type> && !std::is_void_v<Type>>>
+    template<typename Type>
     explicit basic_any(std::in_place_t, Type *value)
         : instance{value} {
+        static_assert(!std::is_const_v<Type> && !std::is_void_v<Type>, "Non-const non-void pointer required");
+
         if(instance != nullptr) {
             initialize<Type &>(*value);
             mode = any_policy::dynamic;

+ 2 - 2
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<typename Type, typename = std::enable_if_t<!std::is_const_v<Type> && !std::is_void_v<Type>>>
+    template<typename Type>
     explicit meta_any(std::in_place_t, Type *value)
         : meta_any{locator<meta_ctx>::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<typename Type, typename = std::enable_if_t<!std::is_const_v<Type> && !std::is_void_v<Type>>>
+    template<typename Type>
     explicit meta_any(const meta_ctx &area, std::in_place_t, Type *value)
         : storage{std::in_place, value},
           ctx{&area} {