Boost logo

Boost Users :

From: Kevin Heifner (heifner_k_at_[hidden])
Date: 2005-04-19 16:23:46


Simon Monckton wrote:
>
> boost::numeric::ublas::vector<double> aVector(4);
>
[snip]
> I am trying to avoid an assignment step like:
>
> for(i=0;i<4;i++) aCorbaVector[i]=aVector[i];
>
>
> In my fantasy world, I'd hoped I might be able to do something like:
>
> aCorbaVector = aVector.data();
>
> where data() returns a pointer to the raw memory area.

Although you should not depend on
boost::numeric::ublas::vector<double> iterators being implemented
with pointers, you could do this:

// IDL
typedef sequence<double> DblSeq;

// C++
boost::numeric::ublas::vector<double> aVector(4)

DblSeq seq;
seq.replace(aVector.size(), aVector.size(), aVector.begin(), 0);

The CORBA sequence also has a similar constructor.

KevinH

-- 
Kevin Heifner  heifner @ ociweb.com  http://heifner.blogspot.com
           Object Computing, Inc. (OCI) www.ociweb.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net