any: internal support for both aggreagates and non-aggregates (qol enhancement :)
This commit is contained in:
@@ -178,9 +178,17 @@ class basic_any {
|
||||
static_assert(sizeof...(Args) == 1u && (std::is_lvalue_reference_v<Args> && ...), "Invalid arguments");
|
||||
instance = (std::addressof(args), ...);
|
||||
} else if constexpr(in_situ<Type>) {
|
||||
new (&storage) Type{std::forward<Args>(args)...};
|
||||
if constexpr(std::is_aggregate_v<Type>) {
|
||||
new (&storage) Type{std::forward<Args>(args)...};
|
||||
} else {
|
||||
new (&storage) Type(std::forward<Args>(args)...);
|
||||
}
|
||||
} else {
|
||||
instance = new Type{std::forward<Args>(args)...};
|
||||
if constexpr(std::is_aggregate_v<Type>) {
|
||||
instance = new Type{std::forward<Args>(args)...};
|
||||
} else {
|
||||
instance = new Type(std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user