diff options
author | dec05eba <0xdec05eba@gmail.com> | 2018-08-08 23:16:21 +0200 |
---|---|---|
committer | dec05eba <0xdec05eba@gmail.com> | 2018-08-08 23:16:25 +0200 |
commit | d03d8c260fbae29f6f87d459670a25130beb2b48 (patch) | |
tree | af527db770a5694fb9642e7b2264ba751c00b984 /include/sibs | |
parent | 142a28cb61c530227833c092273ce9d188faf6a8 (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()); + } } |