std::array
takes two template parameters:
typename T // the element type
size_t N // the size of the array
I want to define a
The N
needs to be a static value. You can, e.g., make a template argument:
template <std::size_t N>
void f(std::array<char, N> x) {
...
}
In your example, I would still pass the argument by reference, though:
template <std::size_t N>
void f(std::array<char, N> const& x) {
...
}
Use a template function:
template<size_t N> void f(array<char, N> x) {
}