Selaa lähdekoodia

storage: minor changes

Michele Caini 6 vuotta sitten
vanhempi
commit
b1e54bfd86
1 muutettua tiedostoa jossa 3 lisäystä ja 8 poistoa
  1. 3 8
      src/entt/entity/storage.hpp

+ 3 - 8
src/entt/entity/storage.hpp

@@ -321,7 +321,7 @@ public:
     template<typename... Args>
     void construct(const entity_type entt, Args &&... args) {
         if constexpr(std::is_aggregate_v<object_type>) {
-            instances.emplace_back(Type{std::forward<Args>(args)...});
+            instances.push_back(Type{std::forward<Args>(args)...});
         } else {
             instances.emplace_back(std::forward<Args>(args)...);
         }
@@ -353,13 +353,8 @@ public:
      */
     template<typename It, typename... Args>
     std::enable_if_t<std::is_same_v<typename std::iterator_traits<It>::value_type, entity_type>, reverse_iterator_type>
-    construct(It first, It last, [[maybe_unused]] Args &&... args) {
-        if constexpr(sizeof...(Args) == 0) {
-            instances.insert(instances.end(), std::distance(first, last), object_type{});
-        } else {
-            instances.insert(instances.end(), std::distance(first, last), object_type{std::forward<Args>(args)...});
-        }
-
+    construct(It first, It last, Args &&... args) {
+        instances.insert(instances.end(), std::distance(first, last), object_type{std::forward<Args>(args)...});
         // entity goes after component in case constructor throws
         underlying_type::construct(first, last);
         return std::make_reverse_iterator(begin() + std::distance(first, last));