How to make variadic template class method take function pointer as argument with type derived from function template?
问题 Sorry the title is a mouthful. I'm working on an array class similar to the one discussed here. I want to define a "map" function that takes a user-defined function and applies it to each element of the array. For the purposes of type-checking, I'd like to define it such that the user-specified function must take the same number of arguments as are passed to the map function, so that double f(double a, double b) { return a + b; } Array<double,2> x, y, z; x.map(f, y, z); will compile but