summaryrefslogtreecommitdiff
path: root/core/variant/variant.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2022-07-28 22:56:41 +0200
committerJuan Linietsky <reduzio@gmail.com>2022-07-29 16:26:13 +0200
commitd4433ae6d3a525683ef37ea521d30b6b97a44024 (patch)
tree35870bbe04b53c95ac9d79cc696f9a5356e62418 /core/variant/variant.h
parent14d021287bced6a7f5ab9db24936bd07b4cfdfd0 (diff)
Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind(). Changed all uses of it to Callable.bind()
Diffstat (limited to 'core/variant/variant.h')
-rw-r--r--core/variant/variant.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/variant/variant.h b/core/variant/variant.h
index 465c31730c..bfa110842a 100644
--- a/core/variant/variant.h
+++ b/core/variant/variant.h
@@ -784,4 +784,14 @@ const Variant::ObjData &Variant::_get_obj() const {
String vformat(const String &p_text, const Variant &p1 = Variant(), const Variant &p2 = Variant(), const Variant &p3 = Variant(), const Variant &p4 = Variant(), const Variant &p5 = Variant());
+template <typename... VarArgs>
+Callable Callable::bind(VarArgs... p_args) {
+ Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; // +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 bindp(sizeof...(p_args) == 0 ? nullptr : (const Variant **)argptrs, sizeof...(p_args));
+}
+
#endif // VARIANT_H