Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-05-16 08:41:59


On Wednesday 16 May 2007 13:22, Neal Becker wrote:
> I can't figure this one out. How can vector_expression not have a
> member 'size'?
>
> #include <boost/numeric/ublas/matrix.hpp>
> #include <boost/numeric/ublas/matrix_proxy.hpp>
>
> namespace ublas = boost::numeric::ublas;
>
>
> template<typename AE>
> void F (ublas::vector_expression<AE> const& mag) {
> int i = mag.size();
> }

the classes vector_expression and matrix_expression have only one member:
operator() - which returns the base object. The correct syntax is

mag () .size();
    ^^ these parentheses return a reference to the actual container.

(this is the price of the CRTP)

mfg
Gunter