Defining a function that takes a std::array as a parameter

arrays, c++

Solution

The only way is to make `f` a function template :

template <size_t N>
void f(array<int, N> x) {
    //do stuff
}

Problem

Basic question here, with (hopefully) a simple answer: I'm trying to write a function whose first argument is a std::array, but with an arbitrary size. ``` void f(array<int> x) { //do stuff } ``` isn't valid, because I need a size for `array<int, #>`. Is there a way to get around this?

Original source

Related problems