#include <iostream>
template <class I>
class B
{
public:
static B b;
I data;
I operator()()
{
data=10;
return data;
}
static B& instance()
{
return b;
}
};
template<class T>
B<T> B<T>::b;
template class B<int>;
typedef B<int> type;
int main()
{
std::cout << type::b()<< std::endl; // 0
return 0;
}
No comments:
Post a Comment