diff --git a/include/mp/proxy-types.h b/include/mp/proxy-types.h index 92bb578..743b210 100644 --- a/include/mp/proxy-types.h +++ b/include/mp/proxy-types.h @@ -189,25 +189,14 @@ struct ReadDestEmplace template void update(UpdateFn&& update_fn) { - update(std::forward(update_fn), Priority<1>()); - } - - template >>, UpdateFn>> - void update(UpdateFn&& update_fn, Priority<1>) - { - update_fn(construct()); - } - - template - void update(UpdateFn&& update_fn, Priority<0>) - { - std::remove_cv_t temp; - update_fn(temp); - construct(std::move(temp)); + if constexpr (std::is_const_v>>) { + std::remove_cv_t temp; + update_fn(temp); + construct(std::move(temp)); + } else { + update_fn(construct()); + } } - EmplaceFn& m_emplace_fn; }; @@ -1073,7 +1062,11 @@ void DefaultPassField(TypeList, ServerContext& server_context, Fn&& f param.emplace(std::forward(args)...); return *param; })); - if (!param) param.emplace(); + if constexpr (Accessor::in) { + assert(param); + } else { + if (!param) param.emplace(); + } fn.invoke(server_context, std::forward(args)..., static_cast(*param)); auto&& results = server_context.call_context.getResults(); MaybeBuildField(std::integral_constant(), TypeList(), invoke_context,