Is there any way to use a template parameter as a variable? for example if I have a function
template<int dim>
void DomainGrid<dim>::getData(Data data_, int field_dim)
{
int size_ = field_dim *dim; // Compiler Error Here
for(int i =0; i<size_; ++i)
std::cout<<data_[i]<<std::endl;
}
Can I get a similar functionality? Compiling this function produces an error at
invalid use of member (did you forget the ‘&’ ?)
the error appears regardless of whether the function is called or not
Which I guess is because of this problem...