A variadic template method to accept a given number of doubles?
template <unsigned int N> class myclass { public: template <typename... Args> void mymethod(Args... args) { // Do interesting stuff } }; I want mymethod to be called only with exactly N doubles. Is that possible? That is, say that I have: myclass <3> x; x.mymethod(3., 4., 5.); // This works x.mymethod('q', 1., 7.); // This doesn't work x.mymethod(1., 2.); // This doesn't work How can I get this done? For the number of arguments constraint you can easily check if sizeof...(Args) == N but for checking if all the arguments are doubles you need to build a recursive type trait that checks std::is