From 2e2df097904dbc92b29baa383e3645e58fe46f72 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Mon, 12 Jun 2023 14:35:39 +0300 Subject: [PATCH] Add geom::concat --- libs/geom/include/psemek/geom/concat.hpp | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 libs/geom/include/psemek/geom/concat.hpp diff --git a/libs/geom/include/psemek/geom/concat.hpp b/libs/geom/include/psemek/geom/concat.hpp new file mode 100644 index 00000000..cb5e3080 --- /dev/null +++ b/libs/geom/include/psemek/geom/concat.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +namespace psemek::geom +{ + + template + auto concat(vector const & ... vs) + { + vector result; + + std::size_t i = 0; + + auto apply = [&](vector const & v) + { + for (std::size_t j = 0; j < N;) + result[i++] = v[j++]; + }; + + (apply(vs), ...); + + return result; + } + +}