Boost logo

Boost Users :

From: Kresimir Fresl (fresl_at_[hidden])
Date: 2003-02-08 03:43:22


speedsnaii wrote:

> Since I did not get an answer on a related question, I am trying to
> state it different.
>
> It seems as if the "[]" access is not supported for const objects. Is
> there a reason for this, or is it a bug?
>
> Example:
> ==========================================================
> #include <boost/numeric/ublas/config.hpp>
> #include <boost/numeric/ublas/vector.hpp>
> #include <boost/numeric/ublas/matrix.hpp>
> using namespace boost::numeric::ublas;
>
> void foo(vector<double>& v, const vector<double>& a)
> {
> }
>
> int main(int argc, char* argv[])
> {
> vector<double> v (3);
> const matrix<double> m(3,3);
>
> foo(v, m[0]);
> }
> ==========================================================
> my compiler does not compile this.

Which compiler? Both g++ 3.2 and Comeau C++ 4.3.0.1 are
quite happy with it.

BTW, do you have the latest version of ublas, from boost CVS?

> This is a problem when I get the matrix as a "const matrix<>& "
> parameter via the argument list.

Sincerely,

fres


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net