I am creating a template class with special behavior for two different sizes and general behavior in a general class, as shown below:
template<typename T, size_t DIM>
class Dataset
{
public:
std::vector<T> _data;
};
Given the data stream for the class below, I expect to access the _data vector, right ?!
template<typename T>
class Dataset<T, 1>
{
public:
T & operator()(const size_t & index)
{
return _data[index];
}
};
however, I get a compilation error _data could not be resolved. What is the problem?!! Thanks
source
share