I don’t even know what title to ask this question; hope the code demonstrates 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;
};
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'
closing class templates are not explicitly specialized
(Turning to // Line A.) What is the correct syntax to do what I want?
Kyle source
share