diff options
Diffstat (limited to 'core/variant/callable.h')
-rw-r--r-- | core/variant/callable.h | 10 |
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 { |