Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2006-12-01 11:21:45


On Monday, 20. November 2006 21:39, Vardan Akopian wrote:
> Hi Gunter,
>
> What is the reason that matrix_expression is not non-copyable? I know
> it's not assignable, but why not make it non-copyable? That would
> prevent passing by value, and thus the wrong initialize() function
> below.

Sound like a good idea. I guess we should experiment and see if there are any
side effects of such a change.

Very occasionally it is useful to copy uBLAS expressions. The following works
at the moment an we would need some alternative constructor if the copy
constructor was removed.
        typedef vector<int> Vec;
        Vec a(1), b(1);

        typedef vector_binary_traits<Vec, Vec, scalar_plus<int,int> >::result_type
BinaryPlus;
        BinaryPlus aplusb = a + b; // copy constructor OK

        a[0] = 1; b[0] = 2;
        std::cout << aplusb[0] << std::endl;

Michael

-- 
___________________________________
Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering
    http://bayesclasses.sf.net
___________________________________