Boost logo

Ublas :

From: e r (erwann.rogard_at_[hidden])
Date: 2007-08-07 15:46:32


hi,

it appears that subrange of a const vector& will achieve read--only

subrange(copy, 0,1);//where copy is a const vector&

however, i am unable to assign it i.e. it is a temporary object so that
in comparing

1. call subrange(copy,0,1) N times
VS.
2. a) create vr1(orig,range(0,1)) and b) call vr1 N times //where orig
is -unfortunately- not a const

i would think that 1. allocates some memory each time it is called
whereas 2. does not, hence is 1. slower. correct?

e r wrote:
> hi all,
>
> i'm wondering how/if i can create vector proxies of a const vector e.g.
>
> typedef boost::numeric::ublas::vector<double> vector_double;
> typedef boost::numeric::ublas::range range;
> typedef boost::numeric::ublas::vector_range<vector_double > vector_range;
>
> vector_double orig(6);
> const vector_double& copy = orig;
> vector_range vr1(orig,range(0,1));
> vector_range vr2(copy,range(0,1));//error: no matching function
>
>
> thanks much!
>
> e.
>