Hi Kresimir, you wrote:
question is the following: Is it intentional, that it is not possible to compile:
#include
#include int main () { using namespace boost::numeric::ublas; matrix<double> m (4, 4); for (unsigned int i = 0; i < m.size1 (); ++ i) for (unsigned int j = 0; j < m.size2 (); ++ j) m(i, j) = 4*i+j;
std::cout << m << std::endl;
swap(row(m,0), row(m,2));
std::cout << m << std::endl; }
No. This one compiles with ICC 7.0 and fails with GCC 3.2.1.
It also fails with como. As it should.
Thanks for checking that!
This is the old problem of binding references to temporaries: parameters of `swap()' are *non-const* references, and they cannot be bound to temporaries returned by `row()'.
It seems that `project()' raises its ugly head again :o(
Not sure about that. Maybe swap()'s signatures are inadequate for the view
classes. If I change matrix_row<>'s swap() member signatures from
void swap (matrix_row &mr);
friend void swap (matrix_row &mr1, matrix_row &mr2);
to
void swap (matrix_row mr);
friend void swap (matrix_row mr1, matrix_row mr2);
the following test program compiles on GCC 3.2.1 and Intel 7.0:
----------
#include