@@ -955,22 +955,26 @@ void CustomBuildField(TypeList<LocalType> local_type,
955
955
template <typename Accessor, typename LocalType, typename ServerContext, typename Fn, typename ... Args>
956
956
void PassField (TypeList<LocalType*>, ServerContext& server_context, const Fn& fn, Args&&... args)
957
957
{
958
- InvokeContext& invoke_context = server_context;
959
- boost::optional<Decay<LocalType>> param;
960
958
const auto & params = server_context.call_context .getParams ();
961
959
const auto & input = Make<StructField, Accessor>(params);
962
- bool want = input. want ();
963
- if (want) {
964
- MaybeReadField (std::integral_constant< bool , Accessor::in>(), TypeList<LocalType>(), invoke_context, input,
965
- Emplace< decltype (param)>(param) );
966
- if (!param) param. emplace () ;
960
+
961
+ if (!input. want () ) {
962
+ fn. invoke (server_context, std::forward<Args>(args)..., nullptr );
963
+ server_context. call_context . getResults ( );
964
+ return ;
967
965
}
968
- fn.invoke (server_context, std::forward<Args>(args)..., param ? &*param : nullptr );
966
+
967
+ InvokeContext& invoke_context = server_context;
968
+ Decay<LocalType> param;
969
+
970
+ MaybeReadField (std::integral_constant<bool , Accessor::in>(), TypeList<LocalType>(), invoke_context, input,
971
+ Emplace<decltype (param)>(param));
972
+
973
+ fn.invoke (server_context, std::forward<Args>(args)..., ¶m);
974
+
969
975
auto && results = server_context.call_context .getResults ();
970
- if (want) {
971
- MaybeBuildField (std::integral_constant<bool , Accessor::out>(), TypeList<LocalType>(), invoke_context,
972
- Make<StructField, Accessor>(results), *param);
973
- }
976
+ MaybeBuildField (std::integral_constant<bool , Accessor::out>(), TypeList<LocalType>(), invoke_context,
977
+ Make<StructField, Accessor>(results), param);
974
978
}
975
979
976
980
template <typename Accessor, typename LocalType, typename ServerContext, typename Fn, typename ... Args>
0 commit comments