}
}
- // Faster to just create a new vector with the element in it?
nodes.erase(nodes.begin(), nodes.begin() + source_node);
nodes.erase(nodes.begin() + 1, nodes.end());
nodes[0].hasDependents = false;
std::vector<Node> nodes;
};
+// Polymorphic functor implementation
+template <typename T>
+class FutureDAGFunctor {
+ public:
+ std::shared_ptr<FutureDAG> dag = FutureDAG::create();
+ T state;
+ std::vector<T> dep_states;
+ T result() {
+ return state;
+ };
+ // execReset() runs DAG & clears all nodes except for source
+ void execReset() {
+ this->dag->go().get();
+ this->dag->reset();
+ };
+ void exec() {
+ this->dag->go().get();
+ };
+ virtual void operator()(){};
+ explicit FutureDAGFunctor(T init_val) : state(init_val) {}
+ FutureDAGFunctor() : state() {}
+ virtual ~FutureDAGFunctor(){};
+};
+
} // folly