Boost logo

Ublas :

From: Markus Weimer (markus.weimer_at_[hidden])
Date: 2007-05-20 03:48:38


Hi,

> } // note the extra () !

What are they good for?

I have little success with the following code:

void printDimension(const matrix_expression<double>& m){
        cout << ()m.size1() << "x" << ()m.size2();
}

int main(int argc, char argv){
        matrix<double> m(1,2);
        printDimension(m);
}

I get the following error when compiling the code:

 error: invalid initialization of reference of type 'const
boost::numeric::ublas::matrix_expression<double>&' from expression of
type 'boost::numeric::ublas::matrix<double,
boost::numeric::ublas::basic_row_major<size_t, ptrdiff_t>,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
> >'
testBoost.cpp:8: error: in passing argument 1 of 'void
printDimension(const
boost::numeric::ublas::matrix_expression<double>&)'

So I guess I made a simple C++ fault. Yet, after years of Java I
cannot bend my head around this. Any hints? The problem apears
regardless of the empty () suggested.

Thanks in advance,

Markus