i need to do a typedef like this.
template< class A, class B, class C >
class X
{
};
template< class B, class C >
typedef X< std::vector<B>, B, C > Y;
I just found that it is not supported in C++. Can someone advise me on how to achieve the same through alternative means?
Thanks, Gokul.
If you have a C++0x/C++1x compiler, that will be allowed with a slightly different syntax (it seems as if compilers don't still support this feature):
template <typename B, typename C>
using Y = X< std::vector<B>, B, C >;
You can use other techniques, like defining an enclosed type in a templated struct (like Pieter suggests), or abusing inheritance (avoid if possible):
template <typename B, typename C>
class Y : public X< std::vector<B>, B, C > {};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With