2009/6/28 Zachary Turner
Is there a way, using some combination of boost preprocessor and mpl, that I can write a class
template
class foo { public: void foo(T arg1, T arg2, ..., T argn); };
In other words, generate a function that requires n arguments where n is a template parameter?
Using preprocessor you can generate a set of functions taking from 0 to M
(some predefined constant) arguments. Inside of these functions static
assert that number of arguments is equal to n. If a caller calls a function
with wrong number of arguments, the compile error will occur, which is
exactly what you need.
#include <iostream>
#include