diff options
author | Nickolai Korshunov <n.a.korshunov@gmail.com> | 2018-04-25 11:40:49 +0300 |
---|---|---|
committer | Nickolai Korshunov <n.a.korshunov@gmail.com> | 2018-04-25 11:40:49 +0300 |
commit | ef37d8d76e45a8249f34e66dfcc80954fecd5981 (patch) | |
tree | 2c155a6f9107b21474e9f1adcb0d4b752bb2e7bc /include/core/Defs.hpp | |
parent | 876715b610a52749e5cc7824122f892dd430ffab (diff) | |
parent | 68ba815bc5c9ffa9494511f9feb8ea36a95369d7 (diff) | |
download | redot-cpp-ef37d8d76e45a8249f34e66dfcc80954fecd5981.tar.gz |
Merge branch 'master' of https://github.com/GodotNativeTools/godot-cpp
Diffstat (limited to 'include/core/Defs.hpp')
-rw-r--r-- | include/core/Defs.hpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/core/Defs.hpp b/include/core/Defs.hpp index 4b73cfa..245e32c 100644 --- a/include/core/Defs.hpp +++ b/include/core/Defs.hpp @@ -58,6 +58,42 @@ enum class Error { ERR_WTF = ERR_OMFG_THIS_IS_VERY_VERY_BAD ///< short version of the above }; + namespace helpers { + template <typename T, typename ValueT> + T append_all (T appendable, ValueT value) { + appendable.append(value); + return appendable; + } + + template <typename T, typename ValueT, typename... Args> + T append_all (T appendable, ValueT value, Args... args) { + appendable.append(value); + return append_all(appendable, args...); + } + + template <typename T> + T append_all (T appendable) { + return appendable; + } + + template <typename KV, typename KeyT, typename ValueT> + KV add_all (KV kv, KeyT key, ValueT value) { + kv[key] = value; + return kv; + } + + template <typename KV, typename KeyT, typename ValueT, typename... Args> + KV add_all (KV kv, KeyT key, ValueT value, Args... args) { + kv[key] = value; + return add_all(kv, args...); + } + + template <typename KV> + KV add_all (KV kv) { + return kv; + } + } + } #include <stdio.h> |