diff options
Diffstat (limited to 'modules/codec/c++')
-rw-r--r-- | modules/codec/c++/data.hpp | 8 | ||||
-rw-r--r-- | modules/codec/c++/interface.hpp | 19 |
2 files changed, 9 insertions, 18 deletions
diff --git a/modules/codec/c++/data.hpp b/modules/codec/c++/data.hpp index 8e0e029..5ebe579 100644 --- a/modules/codec/c++/data.hpp +++ b/modules/codec/c++/data.hpp @@ -176,21 +176,21 @@ public: } data<Schema, encode::Native, storage::Default> operator*(const data<Schema, encode::Native, storage::Default>& rhs) const { - using CalcType = typename native_data_type<Schema::InterfaceSchema>::type; + using CalcType = typename native_data_type<typename Schema::InterfaceSchema>::type; CalcType left = static_cast<CalcType>(value_.get()); CalcType right = static_cast<CalcType>(rhs.get()); return {left * right}; } data<Schema, encode::Native, storage::Default> operator/(const data<Schema, encode::Native, storage::Default>& rhs)const{ - using CalcType = typename native_data_type<Schema::InterfaceSchema>::type; + using CalcType = typename native_data_type<typename Schema::InterfaceSchema>::type; CalcType left = static_cast<CalcType>(value_.get()); CalcType right = static_cast<CalcType>(rhs.get()); return {left / right}; } data<Schema, encode::Native, storage::Default> operator+(const data<Schema, encode::Native, storage::Default>& rhs)const{ - using CalcType = typename native_data_type<Schema::InterfaceSchema>::type; + using CalcType = typename native_data_type<typename Schema::InterfaceSchema>::type; CalcType left = static_cast<CalcType>(value_.get()); CalcType right = static_cast<CalcType>(rhs.get()); return {left + right}; @@ -202,7 +202,7 @@ public: } data<Schema, encode::Native, storage::Default> operator-(const data<Schema, encode::Native, storage::Default>& rhs)const{ - using CalcType = typename native_data_type<Schema::InterfaceSchema>::type; + using CalcType = typename native_data_type<typename Schema::InterfaceSchema>::type; CalcType left = static_cast<CalcType>(value_.get()); CalcType right = static_cast<CalcType>(rhs.get()); return {left - right}; 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); } } }; |