Here's my code:
#include <iostream>
template <typename T>
struct Foo
{
public:
T DataMember;
};
template<>
struct Foo<int>
{
public:
void bar()
{
std::cout << DataMember;
}
};
When I try to compile it, it gives an
error C2065 'DataMember': undeclared identifier
What I want to do is to use templates members in its specialization.
I tried a lot of things and googled the problem for hours, but everything I find is examples that don't use templates members and other questions related to c++ templates, but not the one I need.