Browse Source

any: refine the aggregate support to make any closer to its standard counterpart

Michele Caini 4 years ago
parent
commit
120918bc37
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/entt/core/any.hpp

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

@@ -178,13 +178,13 @@ 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>) {
-                if constexpr(std::is_aggregate_v<Type>) {
+                if constexpr(sizeof...(Args) != 0u && std::is_aggregate_v<Type>) {
                     new (&storage) Type{std::forward<Args>(args)...};
                 } else {
                     new (&storage) Type(std::forward<Args>(args)...);
                 }
             } else {
-                if constexpr(std::is_aggregate_v<Type>) {
+                if constexpr(sizeof...(Args) != 0u && std::is_aggregate_v<Type>) {
                     instance = new Type{std::forward<Args>(args)...};
                 } else {
                     instance = new Type(std::forward<Args>(args)...);