Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2005-07-04 08:58:29


Hallo,

there is a problem with const correctness.

matrix<double> A(10,10);

// this works: a mutable matrix row is returned
cout << A[1] ;

// this fails: a matrix_row<const matrix<double> > should be
// returned but is not found by the compiler
cout << ( (const matrix<double> &) A)[1] ;

the fix is to modify matrix_expression::operator[](index) const this way:

matrix_row<const E> operator[] ( size_t index ) const {
  return matrix_row<const E>( (*this), index );
}

(( I am off my computer, so I hopefully remembered all details correct ))

mfg
Gunter