Ver código fonte

any: use actual constructors to be more like std::any

Michele Caini 5 anos atrás
pai
commit
ba098e1199

+ 2 - 2
src/entt/core/any.hpp

@@ -167,9 +167,9 @@ public:
                 ENTT_ASSERT(((args != nullptr) && ...));
                 instance = (args, ...);
             } else if constexpr(in_situ<Type>) {
-                new (&storage) Type{std::forward<Args>(args)...};
+                new (&storage) Type(std::forward<Args>(args)...);
             } else {
-                instance = new Type{std::forward<Args>(args)...};
+                instance = new Type(std::forward<Args>(args)...);
             }
         }
     }

+ 2 - 0
test/entt/poly/poly_deduced.cpp

@@ -31,6 +31,8 @@ struct Deduced: entt::type_list<> {
 };
 
 struct impl {
+    impl() = default;
+    impl(int v): value{v} {}
     void incr() { ++value; }
     void set(int v) { value = v; }
     int get() const { return value; }

+ 2 - 0
test/entt/poly/poly_defined.cpp

@@ -37,6 +37,8 @@ struct Defined: entt::type_list<
 };
 
 struct impl {
+    impl() = default;
+    impl(int v): value{v} {}
     void incr() { ++value; }
     void set(int v) { value = v; }
     int get() const { return value; }