Boost logo

Ublas :

Subject: Re: [ublas] c_vector and stl algorithm
From: Benjamin Sobotta (mayday_at_[hidden])
Date: 2011-03-15 12:22:43


On Tuesday 15 March 2011 05:13:59 pm Dominic Amann wrote:
> I am having an issue with the c_vector implementation, and I can't find
> docs for it:
>
> I have a type such that:
>
> typedef ublas::c_vector<double, 3> XYZ_vector;
>
> XZY_vector vec1;
> XYZ_vector vec2;
>
> copy(vec1, vec1 + 3, vec2);
>
>
> does not work (operator + not defined for ublas::c_vector<T, N>).
>
> Does this stem from:
>
> a) my mistake (incorrect coding on my part)
> b) c_vector is a bad choice for this algorithm,
> c) c_vector should support this but doesn't?
> d) something else entirely?
>
> and is there an "approved" method of copying a c_vector?

Hello.

Try:

copy(vec1.begin(), vec1.end(), vec2.begin());

HTH,

Benjamin