summaryrefslogtreecommitdiff
path: root/core/variant
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-06 15:55:43 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-06 15:55:43 +0100
commit12b4a263ee3dd9b5a8ffba28b4e5abecc2b4f328 (patch)
treeb5ec66dbec8dcb95af8440bdeadd4e3ac8fce06d /core/variant
parent1836b4b79874e76cfc913a988423ea2b3dfad64c (diff)
parent1778301cd008bb791fd27239e0f2659ae640e351 (diff)
Merge pull request #67730 from KoBeWi/late_to_the_call
Add call_deferred() method to Callable
Diffstat (limited to 'core/variant')
-rw-r--r--core/variant/callable.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/variant/callable.h b/core/variant/callable.h
index 0305dc55c3..32770bd663 100644
--- a/core/variant/callable.h
+++ b/core/variant/callable.h
@@ -73,6 +73,16 @@ public:
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..., 0 }; // +1 makes sure zero sized arrays are also supported.
+ const Variant *argptrs[sizeof...(p_args) + 1];
+ for (uint32_t i = 0; i < sizeof...(p_args); i++) {
+ argptrs[i] = &args[i];
+ }
+ return call_deferredp(sizeof...(p_args) == 0 ? nullptr : (const Variant **)argptrs, sizeof...(p_args));
+ }
+
Error rpcp(int p_id, const Variant **p_arguments, int p_argcount, CallError &r_call_error) const;
_FORCE_INLINE_ bool is_null() const {