Re: template template argument in C++
On 25 Mai, 11:40, nishit.gu...@nsitlounge.in wrote:
Can somebody please send me some good documentation / links explaining
template template arguments in C++, i.e.
I have no links handy. Probably the best source would be a good text
book about C++.
template <int T> struct A
{
};
template <> struct A<32>
{
typedef int B;
};
template <> struct A<64>
{
typedef char B;
};
A template template argument is a template argument that is a class
template. I don't see those in your example. You just declared a class
template which takes a non-type as parameter and provided two
specializations. But you could use this class template as argument for
another template:
template< int I, template<int> class TT >
class foo {
public:
typedef TT<I> tti;
typedef typename tti::B bar;
...
};
Unfortunately, without class template aliases (which will be
introduced in C++0x) those template template arguments are of limited
use.
Cheers!
SG