Boost logo

Boost Users :

From: Simon Monckton (Simon.Monckton_at_[hidden])
Date: 2005-04-19 18:16:12


Thanks, Kevin...thats an interesting idea!

A more difficult question is: Would the same technique be possible for
boost::numeric::ublas::matrix<double> aMatrix(4,4)?

Simon

On Tue, 2005-04-19 at 15:23, Kevin Heifner wrote:
> 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


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