Boost logo

Boost Users :

Subject: Re: [Boost-users] generate structs with all combinations of members from a given struct
From: Larry Evans (cppljevans_at_[hidden])
Date: 2010-01-31 13:03:41


On 01/31/10 08:12, Larry Evans wrote:
> On 01/31/10 07:20, Hicham Mouline wrote:
[snip]

>> Because all the members of params are double, there is no way to
>> differentiate between different the 1st and 2nd vector<double>
>
> Yes; however, Couldn't you, pair each type with it's index?
> IOW, you have, instead of:
>
> typedef
> package_c<int,9001,9002,9003>::pkg_type
> fields_t
> ;
>
> from my earlier attachment, you have:
>
> enum
> field_names
> { field_1
> , field_2
> ...
> , field_n
> };
> typedef
> package
> < pair<integral_c<field_names,field_1>, vector<double> >
> , pair<integral_c<field_names,field_2>, vector<double> >
> ...
> , pair<integral_c<field_names,field_I>, vector<double,double> >
> ...
> >
> fields_t
> ;
>
> Then, the resulting cross_product would be a sequence of pairs
> from which you could generate a fusion map.
[snip]

Such a sequence of sequence of fusion::pair's is generated by the
attached. Generating a fusion map from a sequence of fusion::pairs
has not been done. I didn't see any hint here:

http://www.boost.org/doc/libs/1_41_0/libs/fusion/doc/html/fusion/container/generation/metafunctions/make_map.html

about how to do that. Output from attached is:

--{--output--
absent_fields_seq=
( name=1, type=1)
( name=2, type=2)
( name=3, type=1)
size<select_fields_seq>::value=8
select_fields_seq=
{ absent , absent , absent }
{ absent , absent , ( name= 3, type= 1) }
{ absent , ( name= 2, type= 2) , absent }
{ absent , ( name= 2, type= 2) , ( name= 3, type= 1) }
{ ( name= 1, type= 1) , absent , absent }
{ ( name= 1, type= 1) , absent , ( name= 3, type= 1) }
{ ( name= 1, type= 1) , ( name= 2, type= 2) , absent }
{ ( name= 1, type= 1) , ( name= 2, type= 2) , ( name= 3, type= 1) }
rm_absent_seq=
{ }
{ ( name= 3, type= 1) }
{ ( name= 2, type= 2) }
{ ( name= 2, type= 2) , ( name= 3, type= 1) }
{ ( name= 1, type= 1) }
{ ( name= 1, type= 1) , ( name= 3, type= 1) }
{ ( name= 1, type= 1) , ( name= 2, type= 2) }
{ ( name= 1, type= 1) , ( name= 2, type= 2) , ( name= 3, type= 1) }

--}--output--




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