
Untitled
By: a guest on
Jul 29th, 2012 | syntax:
None | size: 0.99 KB | hits: 9 | expires: Never
Initializing static member of nested templated class during nested template specialization?
template<typename T>
class Outer
{
public:
template<typename U>
class Inner
{
private:
static int count;
};
static int code;
void print() const
{
std::cout << "generic";
}
};
template<>
template<>
class Outer<bool>::Inner<bool>
{
static int count;
};
template<>
template<>
int Outer<bool>::Inner<bool>::count = 4; // ERROR
int Outer<bool>::Inner<bool>::count = 4;
template<typename T>
class Outer
{
public:
template<typename U>
class Inner
{
private:
static int count;
};
static int code;
void print() const
{
std::cout << "generic";
}
};
template<typename T>
int Outer<T>::code = 0;
template<typename T>
template<typename U>
int Outer<T>::Inner<U>::count = 0;
template<>
template<>
class Outer<bool>::Inner<bool>
{
static int count;
};
int Outer<bool>::Inner<bool>::count = 4;