Using Fusion adapted struct with mpl::is_sequence
Hi, I have adapted a struct to be a fusion sequence like so: struct s { uint8_t i; uint8_t j; uint8_t k; }; BOOST_FUSION_ADAPT_STRUCT( s, (uint8_t, i) (uint8_t, j) (uint8_t, k) ) which works fine. However, I pass the adapted struct to my MPL algorithm and it seems to always return false on mpl::is_sequence. If I typedef boost::fusion::fusion_sequence_tag tag in the struct, then it all works, also if I pass in a proper fusion sequence, then that works as well. I was wondering if there was a different way of doing things, I don't really want to require the tag to be typedef'ed in the structure. Thanks, Dave
adapted struct is broken in a couple of ways. I haven't tried your
problem but make sure it isn't a const issue. See
https://svn.boost.org/trac/boost/ticket/3322
Mike
On Sun, Dec 6, 2009 at 8:05 PM, John Smith
Hi, I have adapted a struct to be a fusion sequence like so: struct s { uint8_t i; uint8_t j; uint8_t k; }; BOOST_FUSION_ADAPT_STRUCT( s, (uint8_t, i) (uint8_t, j) (uint8_t, k) ) which works fine. However, I pass the adapted struct to my MPL algorithm and it seems to always return false on mpl::is_sequence. If I typedef boost::fusion::fusion_sequence_tag tag in the struct, then it all works, also if I pass in a proper fusion sequence, then that works as well. I was wondering if there was a different way of doing things, I don't really want to require the tag to be typedef'ed in the structure. Thanks, Dave
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
John Smith schrieb: [snip]
which works fine. However, I pass the adapted struct to my MPL algorithm and it seems to always return false on mpl::is_sequence. If I typedef boost::fusion::fusion_sequence_tag tag in the struct, then it all works, also if I pass in a proper fusion sequence, then that works as well. I was wondering if there was a different way of doing things, I don't really want to require the tag to be typedef'ed in the structure.
This is a bug. Fusion should provide a specialized implementation of mpl::sequence_tag for adapted structures. Please file a bug report. -Christopher
Christopher Schmidt wrote:
John Smith schrieb: [snip]
which works fine. However, I pass the adapted struct to my MPL algorithm and it seems to always return false on mpl::is_sequence. If I typedef boost::fusion::fusion_sequence_tag tag in the struct, then it all works, also if I pass in a proper fusion sequence, then that works as well. I was wondering if there was a different way of doing things, I don't really want to require the tag to be typedef'ed in the structure.
This is a bug. Fusion should provide a specialized implementation of mpl::sequence_tag for adapted structures. Please file a bug report.
FWIW, MPL Forward Sequence concept does not have this requirement. Nor do any of its more specialized concepts. So technically, it is not a bug, IMO. http://www.boost.org/doc/libs/1_41_0/libs/mpl/doc/refmanual/forward-sequence... REgards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon
Christopher Schmidt schrieb:
John Smith schrieb: [snip]
which works fine. However, I pass the adapted struct to my MPL algorithm and it seems to always return false on mpl::is_sequence. If I typedef boost::fusion::fusion_sequence_tag tag in the struct, then it all works, also if I pass in a proper fusion sequence, then that works as well. I was wondering if there was a different way of doing things, I don't really want to require the tag to be typedef'ed in the structure.
This is a bug. Fusion should provide a specialized implementation of mpl::sequence_tag for adapted structures. Please file a bug report.
-Christopher
I just committed a patch to the trunk that should solve this problem. -Christopher
Thanks for that, nice work! On Tue, Dec 15, 2009 at 1:52 PM, Christopher Schmidt < mr.chr.schmidt@online.de> wrote:
Christopher Schmidt schrieb:
John Smith schrieb: [snip]
which works fine. However, I pass the adapted struct to my MPL algorithm and it seems to always return false on mpl::is_sequence. If I typedef boost::fusion::fusion_sequence_tag tag in the struct, then it all works, also if I pass in a proper fusion sequence, then that works as well. I was wondering if there was a different way of doing things, I don't really want to require the tag to be typedef'ed in the structure.
This is a bug. Fusion should provide a specialized implementation of mpl::sequence_tag for adapted structures. Please file a bug report.
-Christopher
I just committed a patch to the trunk that should solve this problem.
-Christopher
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (4)
-
Christopher Schmidt
-
Joel de Guzman
-
John Smith
-
Mike Tegtmeyer