template <unsigned int N> class myclass
{
public:
template <typename... Args> void mymethod(Args... args)
{
// Do interesting stuff
}
};
Run Code Online (Sandbox Code Playgroud)
我希望mymethod只用N双打来打电话.那可能吗?也就是说,我说:
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
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做?