|
Ublas : |
From: Gunter Winkler (guwi17_at_[hidden])
Date: 2005-07-07 07:41:45
On Wednesday 06 July 2005 10:36, Michael Stevens wrote:
> On Monday 04 July 2005 15:58, Gunter Winkler wrote:
> > 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 );
> > }
>
> Ooops. That was my fault with a recent version. Should all be fixed now.
Sorry. It still not works because a matrix_expression<E> is not convertible to
a matrix_expression<const E> . Should we add such a conversion?
I attached a new patch.
mfg
Gunter