I'm not even sure what title to give this question; hopefully the code will demonstrate what I'm trying to do:
#include <string>
#include <list>
using namespace std;
template<typename A> class Alpha { public: A m_alpha_a; };
template<typename B> class Bravo { public: B m_bravo_b; };
template<> class Alpha<string> { public: string m_alpha_string; };
template<typename B>
template<> class Alpha<Bravo<B> >
{
public:
Bravo<B> m_bravo_class; // Line A
};
int main()
{
Alpha<int> alpha_int;
alpha_int.m_alpha_a= 4;
Alpha<string> alpha_string;
alpha_string.m_alpha_string = "hi";
Alpha<Bravo<int> > alpha_bravo_int;
alpha_bravo_int.m_bravo_class.m_bravo_b = 9;
};
I want to write a specialization for Alpha<A>
when A is of any type Bravo<B>
, but the compiler says
invalid explicit specialization before ‘>’ token
enclosing class templates are not explicitly specialized
(Referring to // Line A
.) What's the correct syntax to do what I want?