Implement math::concat for arbitrary types, not just vectors
This commit is contained in:
parent
339de6b218
commit
2f781525d7
1 changed files with 5 additions and 5 deletions
|
|
@ -1,18 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/math/vector.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace psemek::math
|
||||
{
|
||||
|
||||
template <typename T, std::size_t ... Ns>
|
||||
auto concat(vector<T, Ns> const & ... vs)
|
||||
template <template <typename, std::size_t> typename V, typename T, std::size_t ... Ns>
|
||||
auto concat(V<T, Ns> const & ... vs)
|
||||
{
|
||||
vector<T, (Ns + ...)> result;
|
||||
V<T, (Ns + ...)> result;
|
||||
|
||||
std::size_t i = 0;
|
||||
|
||||
auto apply = [&]<std::size_t N>(vector<T, N> const & v)
|
||||
auto apply = [&]<std::size_t N>(V<T, N> const & v)
|
||||
{
|
||||
for (std::size_t j = 0; j < N;)
|
||||
result[i++] = v[j++];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue