Parcourir la source

any: invoke type_id with decayed types to avoid unnecessary instantiations

Michele Caini il y a 4 ans
Parent
commit
976413173a
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      src/entt/core/any.hpp

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

@@ -104,8 +104,8 @@ class basic_any {
     template<typename Type, typename... Args>
     template<typename Type, typename... Args>
     void initialize([[maybe_unused]] Args &&...args) {
     void initialize([[maybe_unused]] Args &&...args) {
         if constexpr(!std::is_void_v<Type>) {
         if constexpr(!std::is_void_v<Type>) {
+            info = &type_id<std::remove_const_t<std::remove_reference_t<Type>>>();
             vtable = basic_vtable<std::remove_const_t<std::remove_reference_t<Type>>>;
             vtable = basic_vtable<std::remove_const_t<std::remove_reference_t<Type>>>;
-            info = &type_id<Type>();
 
 
             if constexpr(std::is_lvalue_reference_v<Type>) {
             if constexpr(std::is_lvalue_reference_v<Type>) {
                 static_assert(sizeof...(Args) == 1u && (std::is_lvalue_reference_v<Args> && ...), "Invalid arguments");
                 static_assert(sizeof...(Args) == 1u && (std::is_lvalue_reference_v<Args> && ...), "Invalid arguments");