summaryrefslogtreecommitdiff
path: root/lib/collections.hpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-12-18 12:41:18 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-12-18 12:41:18 +0000
commit7f42cc44697654f7509ed21afe8966ca81c17edb (patch)
tree134c06ec17cd317541e5851da93edcfc685efd7a /lib/collections.hpp
parentManual Camera Controller should not refer to current properties (diff)
downloadilt-7f42cc44697654f7509ed21afe8966ca81c17edb.tar.bz2
ilt-7f42cc44697654f7509ed21afe8966ca81c17edb.tar.xz
ilt-7f42cc44697654f7509ed21afe8966ca81c17edb.zip
Helper operator+ to join arrays
Diffstat (limited to 'lib/collections.hpp')
-rw-r--r--lib/collections.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/collections.hpp b/lib/collections.hpp
new file mode 100644
index 0000000..ad4d947
--- /dev/null
+++ b/lib/collections.hpp
@@ -0,0 +1,14 @@
+#pragma once
+
+#include <array>
+
+template<typename T, std::size_t first, std::size_t second>
+std::array<T, first + second>
+operator+(const std::array<T, first> & a, const std::array<T, second> & b)
+{
+ std::array<T, first + second> r;
+ auto out = r.begin();
+ out = std::copy(a.begin(), a.end(), out);
+ std::copy(b.begin(), b.end(), out);
+ return r;
+}