@@ -47,11 +47,22 @@ namespace hx
4747 return sizeof ...(TArgs);
4848 }
4949
50- Dynamic __Run (const Array<Dynamic>& inArgs) override final ;
50+ Dynamic __Run (const Array<Dynamic>& inArgs) = 0 ;
5151
5252 virtual TReturn _hx_run (TArgs... args) = 0;
5353 };
5454
55+ template <class TReturn , class ... TArgs>
56+ class HXCPP_EXTERN_CLASS_ATTRIBUTES AutoCallable_obj;
57+
58+ template <class TReturn , class ... TArgs>
59+ class HXCPP_EXTERN_CLASS_ATTRIBUTES AutoCallable_obj<TReturn(TArgs...)> : public ::hx::Callable_obj<TReturn(TArgs...)>
60+ {
61+ Dynamic __Run (const Array<Dynamic>& inArgs) override final ;
62+ };
63+
64+ // ::hx::ObjectPtr overloads
65+
5566 template <class TReturn , class ... TArgs>
5667 class HXCPP_EXTERN_CLASS_ATTRIBUTES Callable;
5768
@@ -83,7 +94,7 @@ namespace hx
8394 Callable (::cpp::Function<TReturn(TArgs...)> inFunction)
8495 : super(nullptr )
8596 {
86- struct FunctionCallable final : public Callable_obj <TReturn(TArgs...)>
97+ struct FunctionCallable final : public AutoCallable_obj <TReturn(TArgs...)>
8798 {
8899 ::cpp::Function<TReturn(TArgs...)> func;
89100
@@ -105,7 +116,7 @@ namespace hx
105116 Callable (const Callable<TOtherReturn(TOtherArgs...)>& inCallable)
106117 : super(nullptr )
107118 {
108- struct AdapterCallable final : public Callable_obj <TReturn(TArgs...)>
119+ struct AdapterCallable final : public AutoCallable_obj <TReturn(TArgs...)>
109120 {
110121 Callable<TOtherReturn(TOtherArgs...)> wrapped;
111122
@@ -138,7 +149,7 @@ namespace hx
138149 Callable (const Callable<void (TOtherArgs...)>& inCallable)
139150 : super(nullptr )
140151 {
141- struct AdapterCallable final : public Callable_obj <TReturn(TArgs...)>
152+ struct AdapterCallable final : public AutoCallable_obj <TReturn(TArgs...)>
142153 {
143154 Callable<void (TOtherArgs...)> wrapped;
144155
@@ -181,7 +192,7 @@ namespace hx
181192 {
182193 if (::hx::IsNotNull (inDynamic) && inDynamic->__GetType () == vtFunction)
183194 {
184- struct DynamicCallable final : public Callable_obj <TReturn(TArgs...)>
195+ struct DynamicCallable final : public AutoCallable_obj <TReturn(TArgs...)>
185196 {
186197 Dynamic wrapped;
187198
@@ -223,8 +234,6 @@ namespace hx
223234 }
224235 };
225236
226- //
227-
228237 template <class ... TArgs>
229238 class Callable <void (TArgs...)> : public ObjectPtr<Callable_obj<void (TArgs...)>>
230239 {
@@ -253,7 +262,7 @@ namespace hx
253262 Callable (::cpp::Function<void (TArgs...)> inFunction)
254263 : super(nullptr )
255264 {
256- struct FunctionCallable final : public Callable_obj <void (TArgs... )>
265+ struct FunctionCallable final : public AutoCallable_obj <void (TArgs... )>
257266 {
258267 ::cpp::Function<void (TArgs...)> func;
259268
@@ -272,7 +281,7 @@ namespace hx
272281 Callable (const Callable<TOtherReturn(TOtherArgs...)>& inCallable)
273282 : super(nullptr )
274283 {
275- struct AdapterCallable final : public Callable_obj <void (TArgs...)>
284+ struct AdapterCallable final : public AutoCallable_obj <void (TArgs...)>
276285 {
277286 Callable<TOtherReturn(TOtherArgs...)> wrapped;
278287
@@ -313,7 +322,7 @@ namespace hx
313322 {
314323 if (::hx::IsNotNull (inDynamic) && inDynamic->__GetType () == vtFunction)
315324 {
316- struct DynamicCallable final : public Callable_obj <void (TArgs...)>
325+ struct DynamicCallable final : public AutoCallable_obj <void (TArgs...)>
317326 {
318327 Dynamic wrapped;
319328
0 commit comments