diff options
Diffstat (limited to 'modules/codec/c++/interface.hpp')
-rw-r--r-- | modules/codec/c++/interface.hpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/modules/codec/c++/interface.hpp b/modules/codec/c++/interface.hpp index 0186f09..0f41f55 100644 --- a/modules/codec/c++/interface.hpp +++ b/modules/codec/c++/interface.hpp @@ -14,12 +14,12 @@ class function; namespace impl { template<typename Request, typename Response, typename Encode, typename Storage, typename Ctx> struct FuncTypeHelper { - using Type = std::function<data<Response, Encode, Storage>(data<Request, Encode, Storage>, Ctx)>; + using Type = std::function<data<Response, Encode, Storage>(data<Request, Encode, Storage>&, Ctx)>; }; template<typename Request, typename Response, typename Encode, typename Storage> struct FuncTypeHelper<Request, Response, Encode, Storage, void_t> { - using Type = std::function<data<Response, Encode, Storage>(data<Request, Encode, Storage>)>; + using Type = std::function<data<Response, Encode, Storage>(data<Request, Encode, Storage>&)>; }; } @@ -41,15 +41,6 @@ public: return func_(req, ctx); } } - - error_or<data<Response, Encode, Storage>> call(data<Request, Encode, Storage>&& req, Context ctx = {}){ - if constexpr (std::is_same_v<Context, void_t>){ - (void) ctx; - return func_(std::move(req)); - } else { - return func_(std::move(req), ctx); - } - } }; template<typename T, typename Encode, typename Storage = storage::Default, typename Context = void_t > @@ -106,14 +97,14 @@ public: Lit, Names... >::value , Requests...>::type - , Encode, Storage> req, + , Encode, Storage>& req, Context ctx = {} ){ if constexpr (std::is_same_v<Context, void_t>) { (void) ctx; - return get<Lit>().call(std::move(req)); + return get<Lit>().call(req); }else{ - return get<Lit>().call(std::move(req), ctx); + return get<Lit>().call(req, ctx); } } }; |