Boost logo

Ublas :

Subject: Re: [ublas] vector< vector< T > > to matrix < T > assignment
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2010-09-11 10:55:49


On Sat, Sep 11, 2010 at 4:30 PM, Matwey V. Kornilov
<matwey.kornilov_at_[hidden]> wrote:
>
> It is not too hard to implement.
>
> Matwey V. Kornilov wrote:
>>
>> I would prefer special adapter:
>>
>> vector< vector<double> > v;
>> matrix< double > m;
>>
>> m = vector_of_vector_as_matrix( v ); //
>> matrix_as_vector_of_vector( m ) = v; //
>>
>> but unfortunately it doesn't exist.
>

Adaptors are good if you want that a type only behaves like another
type, *without* copying data. So any change in the adaptor object
(will change the adapted one).

Instead if you want to simply copy a v< v<> > into a matrix, adaptor
is useless (IMHO); a free function is better.

Best,

-- Marco