$include_dir="/home/hyper-archives/ublas/include"; include("$include_dir/msg-header.inc") ?>
From: Michael Stevens (mail_at_[hidden])
Date: 2005-08-25 09:18:09
Hello again Gunter,
On Wednesday 24 August 2005 14:33, Gunter Winkler wrote:
> Hello,
>
> does anyone have an idea why
>
>     matrix_column<triangular_matrix<DBL, lower> > cLk(L, 1);
>     project( cLk, range(2, 3) )
>       = project( column(A, 2), range(2, 3) );
>
> compiles fine, but
>
>     project( column(L, 2), range(2, 3) )
>       = project( column(A, 2), range(2, 3) );
>
> complains about discarding 'const' qualifier of column(L, 2)?
This is a problem I have been worrying about for a while. 
> Is the type of column(L, 2) a const range even if L is non-const?
column(L,2) returns a non-const matrix_column. In this context however, this 
return value is a temporary object. Temporary objects can only be passed as 
const references. Therefore the const version of project is called in the 
latter case.
This is a fundamental problem with the current implementation of uBLAS 
proxies. They propagate (as a normal object would) this constantness to their 
operations. This is advantageous in that it is consistent with other objects 
and provides error messages at a relatively high level in the instaneation 
hierarchy.
However is prevents all the projection free functions being used in a nested 
form. I would like to experiment with changing the proxies so they respect 
only the constantness of the object the close on. I'm not really sure what 
wider impact this will have.
It would be interesting to here how other libraries deal with the problem of 
closures as temporary return values. MTL3, GLAS anyone?
Michael
-- 
___________________________________
Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering
    http://bayesclasses.sf.net
___________________________________