I have the following “main” template:
template <
template <typename> class S
> struct TT { /*...*/ };
and the template I want to use with TT:
template <int N, typename T> struct S1 {};
In particular, I want to use something like
TT< S1<5> > t2; // "Invalid template arguments" here
It is a kind of partial application for templates. I know that Boost.MPL involves this kind of stuff. The problem is that I already have some code using TT and templates like
template <typename T> struct S2 {}; // S3, S4…
which are fed to TT.
So the question is: how can I use S1 with TT with smallest modifications to existing code. If it is mandatory to use Boost.MPL please show me most suitable solution.
Define a class template deriving from
S1as:And then use
S11, instead ofS1as:Working code : http://ideone.com/y2s7n
Reading your comment, it seems you need this:
Magic Demo : http://ideone.com/4yxvK