-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add call_deferred() method to Callable #67730
Conversation
2e1c0c5
to
189c9dc
Compare
189c9dc
to
932f0da
Compare
core/variant/callable.h
Outdated
@@ -73,6 +73,16 @@ class Callable { | |||
void call_deferredp(const Variant **p_arguments, int p_argcount) const; | |||
Variant callv(const Array &p_arguments) const; | |||
|
|||
template <typename... VarArgs> | |||
void call_deferred(VarArgs... p_args) const { | |||
Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; // +1 makes sure zero sized arrays are also supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./core/variant/callable.h:78:54: error: invalid use of incomplete type 'Variant'
Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; // +1 makes sure zero sized arrays are also supported.
^~~~~~~~~
./core/variant/array.h:38:7: note: forward declaration of 'Variant'
class Variant;
^
Should likely be in the .cpp
as we probably don't want to include Variant here to avoid circular deps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Template functions can't be defined in cpp. I found a promising workaround though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me, should be good to merge once it builds :)
932f0da
to
1778301
Compare
Thanks! |
For whatever reason the C++ Callable never got
call_deferred()
method and to defer a call you had tocall_deferredp(nullptr, 0);
.