Subject: Re: [ublas] fixed size vector in boost::numeric::ublas?
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2010-07-23 08:51:45
On Fri, Jul 23, 2010 at 2:43 PM, Nasos Iliopoulos <nasos_i_at_[hidden]> wrote:
> The c_vector indeed works on the stack, but it still has a redundant size
> member function, that when used small fixed containers (i.e. 2 element
> vectors), causes some serious memory overhead.
> Furthermore getting rid of the size member variable opens a nice opportunity
> to cast items from and to a fixed_vector (or matrix) for a variety of nice
> interfacing tricks.
> For example consider the following:
> std::vector<ublas::fixed_vector<float,3> > vertices;
> the following statement:
> static_cast<float *>(&vertices)
> will return a pointer that can go directly to say OpenGL to create a vertex
> buffer, while at the same time retain all the uBlas stuff to operate on your
> vertices! (as long as you don't want to go the shader way and you can afford
> to update the vertices every frame - a common scenario when you morph them).
Uhh I did't get this point.
That's very interesting!!!
Thank you very much for the explanation.