Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-07-07 12:07:12


On Thursday 07 July 2005 14:41, Gunter Winkler wrote:
> 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> .

I should apply these quick patches after a hard days programming! I have
applied and extended to vector_expression also.

> Should we add such a conversion?

Hard question. I is not needed for uBLAS internally, and I can't think of a
purpose!

Thanks,
        Michael