diff --git a/include/sled/operations_chain.h b/include/sled/operations_chain.h index 3f210cb..7a80e6d 100644 --- a/include/sled/operations_chain.h +++ b/include/sled/operations_chain.h @@ -5,6 +5,7 @@ **/ #pragma once +#include "sled/make_ref_counted.h" #ifndef SLED_OPERATIONS_CHAIN_H #define SLED_OPERATIONS_CHAIN_H @@ -60,12 +61,14 @@ public: bool IsEmpty() const; template - void ChainOperation(FunctorT &&functor) + scoped_refptr ChainOperation(FunctorT &&functor) { - auto wrapper = new internal::OperationWithFunctor(std::forward(functor), CreateOpeartionsChainCallback()); + auto wrapper = new internal::OperationWithFunctor(std::forward(functor), + CreateOpeartionsChainCallback()); chained_operations_.push(std::unique_ptr>(wrapper)); if (chained_operations_.size() == 1) { chained_operations_.front()->Run(); } + return scoped_refptr(this); } private: