Boost logo

Boost Users :

Subject: Re: [Boost-users] [fusion] memory layout of fusion::vector vs boost::tuple/boost::array
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-10-07 20:13:03


On Thu, Oct 7, 2010 at 5:42 PM, Alfredo Correa <alfredo.correa_at_[hidden]> wrote:
> On Thu, Oct 7, 2010 at 3:33 PM, OvermindDL1 <overminddl1_at_[hidden]> wrote:
>> You do know that based on this:
>>
>>  http://www.boost.org/doc/libs/1_44_0/libs/fusion/doc/html/fusion/adapted/boost__array.html
>> boost::array is already adapted as a fusion container and can be used
>> directly, as soon as you include the proper hpp that is?
>
> yes, thank you, that what I wrote in my last post . I can make this work
>
> #include <boost/fusion/adapted/boost_array.hpp>
> #include <boost/fusion/include/boost_array.hpp>
> ...
> boost::array<double, 3> boostarr={{1.0, 2.1, 3.2}};
> vector<double, double, double> fusionvec(boostarr); //now works

Ah, heh, got lost in the noise and I missed it.

On Thu, Oct 7, 2010 at 5:42 PM, Alfredo Correa <alfredo.correa_at_[hidden]> wrote:
> I still can't do the other way around:
>
> boost::array<double, 3> boostarr2(fusionvec); //doesn't work
> ideas?

I know that would not work because that is still a 'custom' type as
far as fusion is concerned, and only free functions can work on it, a
constructor is obviously not a free function, so you need to write a
free function to do it (probably called 'copy', probably using
fusion's foreach to copy each element one to the other, should be
pretty well optimized out thanks to the template-magic).


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