Boost logo

Ublas :

Subject: Re: [ublas] ublas::vector and a "random access" container concept? And ublas::matrix.
From: Gunter Winkler (guwi17_at_[hidden])
Date: 2009-01-22 15:14:26

Am Donnerstag, 22. Januar 2009 20:11 schrieb jesseperla_at_[hidden]:
> I have been writing a lot of generic code recently that needs to
> operate on boost::array, std::vector, and ublas::vector
> I have found the lack of operator[] for random element access to be a
> real pain for writing generic code, and it seems to be inconsistent
> with the others. I understand the rationale for not having
> operators[] on ublas::matrix, to be discussed later, but why cannot
> operator() and operator[] call the same code for ublas::vector? Am I
> missing something? Right now my workaround is to use .begin() and
> then use the random access iterator concept implemented by all of
> these iterators. But this is really ugly for many cases.

have you tried to define


AFAIR this should make matrix[i] return a matrix_row reference.