any: use actual constructors to be more like std::any
This commit is contained in:
@@ -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)...);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user