Boost logo

Ublas :

Subject: Re: [ublas] indirect_array cast
From: Ralf Denzer (Ralf.Denzer_at_[hidden])
Date: 2011-03-14 16:37:49


 Hi Phil,

> but I need the indirect_array<> and I have tried the

> std::copy( l_temp.begin(), l_temp.end(), l_idx.begin() );

> and get the error "assignment of read-only location"

you may try

std::copy( l_temp.begin(), l_temp.end(), &l_idx(0) );

There is a problem in the design of indirect_array:
l_idx.begin() is a const iterator, thus your compiler error.
&l_idx(0) gives a non-const reference, so you can use
it for writing data with std::copy()

Check Nasos comment in
http://answerpot.com/showthread.php?726979-submatrix+with+indexvector

 Ralf


 


 

  

WEB.DE DSL Doppel-Flat ab 19,99 €/mtl.! Jetzt mit    
gratis Handy-Flat! http://produkte.web.de/go/DSL_Doppel_Flatrate/2