, const non-const , . , -, , :
class Proxy
{
Matrix& m;
int x, y;
public:
...
operator double&() { check(); return m.index(x,y); }
double& operator=(double d) { check(); return m.index(x,y)=d; }
operator double() { return m.const_index(x, y); }
operator const double&()
};
Proxy Matrix::operator(int x, int y)
{
return Proxy(*this, x, y);
}
, check() ( index()), index() const_index() - , .