i think you misunderstood my question...
i took the template...
Code:
template<typename T>
class C2DMatrix
{
public:
C2DMatrix() {}
C2DMatrix(unsigned, unsigned );
T& operator() (unsigned, unsigned);
const T& operator() (unsigned i, unsigned j) const;
size_t nRows_;
size_t nCols_;
vector<vector<T> > data_;
private:
template <typename _T>
friend ostream& operator<<(ostream& os, C2DMatrix<_T>& c2d );
};
and changed the class to 'int' type..
Code:
class C2DMatrix
{
public:
C2DMatrix() {}
C2DMatrix(unsigned, unsigned );
int operator() (unsigned, unsigned);
const int operator() (unsigned i, unsigned j) const;
size_t nRows_;
size_t nCols_;
vector<vector<int> > data_;
private:
friend ostream& operator<<(ostream& os, C2DMatrix& c2d );
};
now assignment (ex: array(int,int) = int ) gives me that lvalue error.
So I was asking if there were anything different about how template classes are interpreted or referenced, compared to a non-template class. My understanding of templates is that the template type is bound at compile time, so I don't see why C2DMatrix<int> array, would be any different from C2DMatrix array (if C2DMatrix was hardcoded to type 'int'). ;p