C++ meta-splat function
- by aaa
hello.
Is there an existing function (in boost mpl or fusion) to splat meta-vector to variadic template arguments?
for example:
splat<vector<T1, T2, ...>, function>::type
same as
function<T1, T2, ...>
my search have not found one, and I do not want to reinvent one if it already exists.
edit:
after some tinkering, apparently it's next to impossible to accomplish this in general way, as it would require declaring full template template parameter list for all possible cases. only reasonable solution is to use macro:
#define splat(name, function) \
template<class T, ...> struct name; \
template<class T> \
struct name<T,typename boost::enable_if_c< \
result_of::size<T>::value == 1>::type> { \
typedef function< \
typename result_of::value_at_c<T,0>::type \
> type; \
};
Oh well.
thank you