Explorar el Código

flow: increase code coverage, simplify the internals

Michele Caini hace 3 años
padre
commit
df10a01af9
Se han modificado 1 ficheros con 2 adiciones y 7 borrados
  1. 2 7
      src/entt/graph/flow.hpp

+ 2 - 7
src/entt/graph/flow.hpp

@@ -131,13 +131,8 @@ public:
      * @return This flow builder.
      */
     basic_flow &task(id_type value) {
-        if(const auto it = vertices.find(value); it == vertices.cend()) {
-            index.first() = vertices.size();
-            vertices.emplace(value);
-        } else {
-            index.first() = static_cast<size_type>(it - vertices.cbegin());
-        }
-
+        const auto it = vertices.emplace(value).first;
+        index.first() = size_type(it - vertices.begin());
         return *this;
     }