From 3bcd014992a5f39cdad91d0cd8efe159ae786dec Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:40:49 +0800 Subject: [PATCH] feat support chain operator --- include/sled/operations_chain.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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: