2828
2929namespace rtl ::detail
3030{
31- /* @method : call()
32- @params: params... (corresponding to functor associated with 'm_method')
33- @return: RObject, indicating success of the reflected call.
34- * invokes non-static-member-function functor associated with 'm_method' on object 'm_target'.
35- */ template <class ..._signature>
31+ /* @lambda : call()
32+ @params: params... (corresponding to functor associated with 'm_method')
33+ @return: RObject, indicating success of the reflected call.
34+ * invokes non-static-member-function functor associated with 'm_method' on object 'm_target'.
35+ */ template <class ..._signature>
3636 template <class ..._args>
3737 ForceInline Return DefaultInvoker<_signature...>::call(_args&& ...params) const noexcept
3838 {
@@ -61,14 +61,14 @@ namespace rtl::detail
6161 }
6262
6363
64- // Invoker struct's static method definition
64+ // Invoker struct's static lambda definition
6565 template <class ..._signature>
6666 template <class ..._invokSignature>
6767 template <class ..._args>
6868 ForceInline Return
69- DefaultInvoker<_signature...>::Invoker<_invokSignature...>::invoke(const Method& pMethod,
70- const RObject& pTarget,
71- _args&&... params)
69+ DefaultInvoker<_signature...>::Invoker<_invokSignature...>::invoke(const Method& pMethod,
70+ const RObject& pTarget,
71+ _args&&... params)
7272 {
7373 using containerConst = detail::MethodContainer<detail::member::Const, _invokSignature...>;
7474 const FunctorId* constFunctorId = pMethod.hasFunctorId (containerConst::getContainerId ());
@@ -97,11 +97,11 @@ namespace rtl::detail
9797
9898namespace rtl ::detail
9999{
100- /* @method : call()
101- @params: params... (corresponding to functor associated with 'm_method')
102- @return: RObject, indicating success of the reflected call.
103- * invokes non-static-member-function functor associated with 'm_method' on object 'm_target'.
104- */ template <class ..._signature>
100+ /* @lambda : call()
101+ @params: params... (corresponding to functor associated with 'm_method')
102+ @return: RObject, indicating success of the reflected call.
103+ * invokes non-static-member-function functor associated with 'm_method' on object 'm_target'.
104+ */ template <class ..._signature>
105105 template <class ..._args>
106106 ForceInline Return NonConstInvoker<_signature...>::call(_args&& ...params) const noexcept
107107 {
@@ -128,24 +128,24 @@ namespace rtl::detail
128128 }
129129
130130
131- // Invoker struct's static method definition
131+ // Invoker struct's static lambda definition
132132 template <class ..._signature>
133133 template <class ..._invokSignature>
134134 template <class ..._args>
135135 ForceInline Return
136- NonConstInvoker<_signature...>::Invoker<_invokSignature...>::invoke(const Method& pMethod,
137- const RObject& pTarget,
138- _args&&... params)
136+ NonConstInvoker<_signature...>::Invoker<_invokSignature...>::invoke(const Method& pMethod,
137+ const RObject& pTarget,
138+ _args&&... params)
139139 {
140140 using container0 = detail::MethodContainer<detail::member::NonConst, _invokSignature...>;
141141 const FunctorId* functorId = pMethod.hasFunctorId (container0::getContainerId ());
142142
143143 if (functorId != nullptr ) [[likely]] {
144144 return container0::template forwardCall<_args...>(*functorId, pTarget, std::forward<_args>(params)...);
145145 }
146- else
146+ else
147147 {
148- // check if the const-overload method is present.
148+ // check if the const-overload lambda is present.
149149 using container2 = detail::MethodContainer<detail::member::Const, _invokSignature...>;
150150 std::size_t index = pMethod.hasSignatureId (container2::getContainerId ());
151151 if (index != rtl::index_none) {
@@ -163,7 +163,7 @@ namespace rtl::detail
163163{
164164 template <class record_t , class ...args_t >
165165 template <class return_t > requires (!traits::type_aware_v<record_t , return_t >)
166- inline constexpr const method<record_t, return_t(args_t ...)> HopMethod<record_t, args_t...>::returnT() const
166+ inline constexpr const method<record_t, return_t(args_t ...)> HopMethod<record_t, args_t...>::returnT() const
167167 {
168168 method<record_t , return_t (traits::normal_sign_t <args_t >...)> erasedMth;
169169 initHopper<return_t >(erasedMth);
@@ -173,7 +173,7 @@ namespace rtl::detail
173173
174174 template <class record_t , class ...args_t >
175175 template <class return_t > requires (traits::type_aware_v<record_t , return_t >)
176- inline constexpr const method<record_t, return_t(args_t ...)> HopMethod<record_t, args_t...>::returnT() const
176+ inline constexpr const method<record_t, return_t(args_t ...)> HopMethod<record_t, args_t...>::returnT() const
177177 {
178178 method<record_t , return_t (args_t ...)> mth;
179179 if (!m_argsTfnMeta.is_empty ())
@@ -185,8 +185,8 @@ namespace rtl::detail
185185
186186 const auto retId = traits::uid<return_t >::value;
187187 return m_argsTfnMeta.get_lambda ()
188- .template to_method <record_t , args_t ...>()
189- .template get_hopper <return_t >(retId);
188+ .template to_method <record_t , args_t ...>()
189+ .template get_hopper <return_t >(retId);
190190 }
191191 }
192192 return mth;
@@ -244,54 +244,61 @@ namespace rtl::detail
244244
245245 template <class record_t , class ...args_t >
246246 template <class return_t > requires (!traits::type_aware_v<record_t , return_t >)
247- inline void HopMethod<record_t, args_t...>::initHopper(method<record_t , return_t (args_t ...)>& pMth ) const
247+ inline void HopMethod<record_t, args_t...>::initHopper(method<record_t , return_t (args_t ...)>& pHopper ) const
248248 {
249249 bool isReturnTvoid = false ;
250- for (auto & fnMeta : m_overloadsFnMeta)
250+ for (auto & ty_meta : m_overloadsFnMeta)
251251 {
252- if (fnMeta .is_empty ())
252+ if (ty_meta .is_empty ())
253253 {
254- pMth .get_vhop ().push_back (nullptr );
255- pMth .get_rhop ().push_back (nullptr );
256- pMth .get_overloads ().push_back (nullptr );
254+ pHopper .get_vhop ().push_back (nullptr );
255+ pHopper .get_rhop ().push_back (nullptr );
256+ pHopper .get_overloads ().push_back (nullptr );
257257 continue ;
258258 }
259259
260- if (fnMeta .get_member_kind () == member::Static) {
261- pMth .set_init_error (error::InvalidStaticMethodCaller);
260+ if (ty_meta .get_member_kind () == member::Static) {
261+ pHopper .set_init_error (error::InvalidStaticMethodCaller);
262262 return ;
263263 }
264264
265- auto & erasedFn = [&]() -> decltype (auto ) {
266- if constexpr (traits::type_erased_v<record_t , return_t >) {
267- return fnMeta.get_erasure_base ()
268- .template to_erased_record <traits::normal_sign_t <args_t >...>();
265+ auto lambda = [&]<dispatch::fn_void void_v>() -> decltype (auto )
266+ {
267+ if constexpr (traits::type_erased_v<record_t , return_t >)
268+ {
269+ using fn_cast = dispatch::functor_cast<void_v, traits::normal_sign_t <args_t >...>;
270+ return fn_cast (ty_meta.get_functor ()).to_method ();
269271 }
270- else if constexpr (traits::target_erased_v<record_t , return_t >) {
271- return fnMeta.get_erasure_base ()
272- .template to_erased_target_aware_return <return_t , traits::normal_sign_t <args_t >...>();
272+ else if constexpr (traits::target_erased_v<record_t , return_t >)
273+ {
274+ using fn_cast = dispatch::functor_cast<void_v, traits::normal_sign_t <args_t >...>;
275+ return fn_cast (ty_meta.get_functor ()).template to_method <dispatch::erase::t_target, return_t >();
273276 }
274- else if constexpr (traits::return_erased_v<record_t , return_t >) {
275- return fnMeta.get_erasure_base ()
276- .template to_erased_return_aware_target <record_t , traits::normal_sign_t <args_t >...>();
277+ else if constexpr (traits::return_erased_v<record_t , return_t >)
278+ {
279+ using fn_cast = dispatch::functor_cast<void_v, traits::normal_sign_t <args_t >...>;
280+ return fn_cast (ty_meta.get_functor ()).template to_method <dispatch::erase::t_return, record_t >();
277281 }
278- }() ;
282+ };
279283
280- if (fnMeta.is_void ()) {
281- isReturnTvoid = true ;
282- pMth.get_vhop ().push_back (erasedFn.get_void_hopper ());
284+ if (isReturnTvoid = ty_meta.is_void ())
285+ {
286+ auto fn = lambda.operator () < dispatch::fn_void::yes > ();
287+ pHopper.get_vhop ().push_back (fn.get_hop ());
283288 }
284289 else {
285- pMth.get_rhop ().push_back (erasedFn.get_return_hopper ());
290+ auto fn = lambda.operator () < dispatch::fn_void::no > ();
291+ pHopper.get_rhop ().push_back (fn.get_hop ());
286292 }
287- pMth.get_overloads ().push_back (&fnMeta.get_lambda ());
288- pMth.set_init_error (error::None);
293+
294+ pHopper.get_overloads ().push_back (&ty_meta.get_lambda ());
295+ pHopper.set_init_error (error::None);
289296 }
290297 if (isReturnTvoid) {
291- pMth .get_rhop ().clear ();
298+ pHopper .get_rhop ().clear ();
292299 }
293300 else {
294- pMth .get_vhop ().clear ();
301+ pHopper .get_vhop ().clear ();
295302 }
296303 }
297304}
0 commit comments