On Oct 6, 5:33 pm, Joel de Guzman wrote:
On 10/7/2010 3:53 AM, alfC wrote:
Hi,
I am trying to convert a boost::array into a fusion::vector.
reinterpreting the memory from boost::array. It works for tuples but
not fusion::vector, why is that. Is there a way to make it work? ( I
was hoping that the memory layout is the same to make conversion from
one to the other very easy.)
Don't do that. It will *never* be guaranteed to work even if it works
now. The memory layout of fusion::vector is an internal implementation
detail and can change anytime.
The question is: is it guaranteed for boost::tuples?
(it seems so, just by the PODness of tuples of PODs in its stated
design.) If so, then it is a *feature* of boost::tuple.
Fusion, which is supposed to be an extension of boost::tuple (or at
least that was my understanding), lost such feature that I could
exploit.
The situation is the following: quantity because it claims that
has no runtime cost, this is like saying that it can be interpreted as
its underlying type T (e.g. double). All numerical routines that I am
using take fixed arrays of double or basically boost::arrays. The
analogy is perfect if I use tuples because I can reinterpret them as
arrays back *and* forth without copying anything or adding any
additional code.
Since I can't do this with fusion::vector then I will have to use
boost::tuples. This will be a pain in it self because then I will have
to manually code MPL to tuples generation and loose the nice
fusion::transforms. It seem I am out of luck, and just fallen in a
crack between tuples and fusion.
There is second possibility that is that I got the boost::fusion
theory totally wrong in the first place.
Thanks so much for your help,
Alfredo.
Regards,
--
Joel de Guzmanhttp://www.boostpro.comhttp://spirit.sf.net
_______________________________________________
Boost-users mailing list
Boost-us...@lists.boost.orghttp://lists.boost.org/mailman/listinfo.cgi/boost-users