Original Post
Boost function has 2 ways to define a function, the portable syntax and the preferred syntax. The portable seems pretty simple, a function like: is defined like: The preferred syntax for the same function looks like: Now the question is, how would you write a template to support the preferred syntax? What I mean is, if I were to write a template class to support the portable syntax, I imagine it'd look something like this: But I'm not sure how I'd write a template class to accept something along the lines of Function, like the boost function preferred syntax. I tried looking at the boost function source, but its filled with macros, and I can't figure out what they're doing. Anyone have any thoughts?
int func (bool);
boost::function<int,bool> f;
boost::function<int (bool)> f;
template <typename TR = void, typename T1 = void, typename T2 = void /* ect... */ > class FunctionWrapperOfSomeSort {};
template <> class FunctionWrapperOfSomeSort<void,void,void> {};
template <typename TR> class FunctionWrapperOfSomeSort<TR,void,void> {};
template <typename TR, typename T1> class FunctionWrapperOfSomeSort<TR,T1,void> {};
// ect...