As a lazy developer, I like to use this trick to specify a default function:
template
You can just build your own identity functor:
template
class returnIdentifyFunctor
{
public:
auto operator ()( T &&i ) -> decltype( std::forward(i) )
{
return std::move(i);
}
};
template >
void index(std::array &x, Function&& f = Function() )
{
for (unsigned int i = 0; i < Size; ++i) {
x[i] = f(i);
}
}