diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-08-08 23:16:21 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:50:13 +0200 |
commit | d265c4422c8100665cc5bf302407172ea6ce07cd (patch) | |
tree | 60bd3c419a7ed8d46ccb3eea250d7caf34ad1dac /include/sibs | |
parent | ab80c5bbc86d45032564b73757e8b09c5ad4f798 (diff) |
Add helper functions
Diffstat (limited to 'include/sibs')
-rw-r--r-- | include/sibs/Functional.hpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/sibs/Functional.hpp b/include/sibs/Functional.hpp index 53d8ff0..7c51883 100644 --- a/include/sibs/Functional.hpp +++ b/include/sibs/Functional.hpp @@ -74,7 +74,7 @@ namespace sibs } - Function& merge(Function &otherFunc) + Function& merge(const Function &otherFunc) { connections.push_back(otherFunc); return *this; @@ -110,4 +110,16 @@ namespace sibs T *endIt; std::vector<Function> connections; }; + + template <typename T> + static Function<T> makeFunction(T *begin, T *end) + { + return Function<T>(begin, end); + } + + template <typename T> + static Function<T> makeFunction(std::vector<T> &vec) + { + return Function<T>(vec.data(), vec.data() + vec.size()); + } } |