What would be the correct syntax to use the '=' to set some value to a class member and supply additional arguments? E.g. positions in a vector:
MyClass<float> mt;
mt(2,4) = 3.5;
I've tried:
template <class _type>
_type myClass<_type>::operator()(int r,int c) {
return data[r*nCols+c];
};
template <class _type>
myClass<_type>::operator= (int r, int c, _type val) {
data(r,c) = val;
};
But the compiler tells me I can override the '=' operator with 1 argument.