[fusion][mpl] Generating a fusion sequence type from an MPL sequence

Hi all, I am unexpectedly stuck looking for some functionality which I assumed would be present. Given an MPL sequence, I want to generate the type of a corresponding fusion sequence, which I can then use to store things: mpl::vector<int, string> mpl_vec; typedef some_metafunction<mpl_vec>::type fusion_vec; // equivalent to fusion::vector<int, string> fusion_vec vec(5, "foo"); Does some_metafunction exist? I'm not sure if I'm just not seeing it (or perhaps thinking wrongly about the problem), or if it really is not present. I was looking at the fusion/mpl bridge at [1], but its functionality seems orthogonal to what I want. Thanks, -Gabe [1] http://www.boost.org/doc/libs/1_44_0/libs/fusion/doc/html/fusion/adapted/mpl...

On 10/19/2010 3:24 AM, Gabriel Redner wrote:
Hi all,
I am unexpectedly stuck looking for some functionality which I assumed would be present. Given an MPL sequence, I want to generate the type of a corresponding fusion sequence, which I can then use to store things:
mpl::vector<int, string> mpl_vec; typedef some_metafunction<mpl_vec>::type fusion_vec; // equivalent to fusion::vector<int, string> fusion_vec vec(5, "foo");
Does some_metafunction exist? I'm not sure if I'm just not seeing it (or perhaps thinking wrongly about the problem), or if it really is not present.
I was looking at the fusion/mpl bridge at [1], but its functionality seems orthogonal to what I want.
Thanks, -Gabe
[1] http://www.boost.org/doc/libs/1_44_0/libs/fusion/doc/html/fusion/adapted/mpl...
Sure. Check out fusion::as_vector. You can use it to convert any fusion compatible sequence to a fusion vector. MPL sequences are fusion compatible. typedef fusion::result_of::as_vector<mpl_vec>::type fusion_vec; Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net
participants (2)
-
Gabriel Redner
-
Joel de Guzman