summaryrefslogtreecommitdiff
path: root/lib/util.h
blob: 290492f3d2b51727db2df8e4e126512ac7dab3ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#pragma once

#include <algorithm> // IWYU pragma: keep
#include <array>
#include <cstddef>

template<typename T, std::size_t N>
constexpr auto
transform_array(const std::array<T, N> & in, auto && transform)
{
	std::array<decltype(transform(in.front())), N> out {};
	std::transform(in.begin(), in.end(), out.begin(), transform);
	return out;
}