summaryrefslogtreecommitdiff
path: root/modules/codec/c++/interface.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/codec/c++/interface.hpp')
-rw-r--r--modules/codec/c++/interface.hpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/codec/c++/interface.hpp b/modules/codec/c++/interface.hpp
index d55b415..0186f09 100644
--- a/modules/codec/c++/interface.hpp
+++ b/modules/codec/c++/interface.hpp
@@ -33,7 +33,16 @@ public:
func_{std::move(func)}
{}
- error_or<data<Response, Encode, Storage>> call(data<Request, Encode, Storage> req, Context 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_(req);
+ } else {
+ 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));