diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-11-28 14:47:55 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-01-19 13:12:21 +0200 |
commit | abca497b7223eed94ae4cbd65119ddfce7941027 (patch) | |
tree | f9c7ff27533e4ee848746ddedcb11e4be0ea2e23 /include/godot_cpp/variant | |
parent | 69b525494bf41097edc86d44b1d4b11ddfeb2440 (diff) | |
download | redot-cpp-abca497b7223eed94ae4cbd65119ddfce7941027.tar.gz |
Expose some low level functions and String operators.
Diffstat (limited to 'include/godot_cpp/variant')
-rw-r--r-- | include/godot_cpp/variant/variant.hpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/godot_cpp/variant/variant.hpp b/include/godot_cpp/variant/variant.hpp index b131d74..06ba75f 100644 --- a/include/godot_cpp/variant/variant.hpp +++ b/include/godot_cpp/variant/variant.hpp @@ -322,6 +322,18 @@ struct VariantComparator { static _FORCE_INLINE_ bool compare(const Variant &p_lhs, const Variant &p_rhs) { return p_lhs.hash_compare(p_rhs); } }; +template <typename... VarArgs> +String vformat(const String &p_text, const VarArgs... p_args) { + Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; // +1 makes sure zero sized arrays are also supported. + Array args_array; + args_array.resize(sizeof...(p_args)); + for (uint32_t i = 0; i < sizeof...(p_args); i++) { + args_array[i] = args[i]; + } + + return p_text % args_array; +} + } // namespace godot #endif // GODOT_VARIANT_HPP |