[fusion] bug in end_impl for struct_tag

I've encountered fusion's behavior that seems to be a bug. #include <boost/mpl/assert.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/end.hpp> #include <boost/fusion/adapted/struct/adapt_struct.hpp> #include <boost/fusion/iterator/next.hpp> struct s { int m; }; BOOST_FUSION_ADAPT_STRUCT(s, (int, m)) int main() { using namespace boost::fusion; using boost::is_same; typedef result_of::begin<s>::type b; typedef result_of::end<s>::type e; // this fails BOOST_MPL_ASSERT((is_same<result_of::next<b>::type, e>)); } Here is a patch against trunk: Index: end_impl.hpp =================================================================== --- end_impl.hpp (revision 42137) +++ end_impl.hpp (working copy) @@ -8,6 +8,7 @@ #if !defined(BOOST_FUSION_END_IMPL_24122005_1755) #define BOOST_FUSION_END_IMPL_24122005_1755 +#include <boost/fusion/adapted/struct/extension.hpp> #include <boost/fusion/adapted/struct/struct_iterator.hpp> namespace boost { namespace fusion @@ -25,7 +26,7 @@ template <typename Sequence> struct apply { - typedef struct_iterator<Sequence, 2> type; + typedef struct_iterator<Sequence, struct_size<Sequence>::value> type; static type call(Sequence& v) Regards, Roman Perepelitsa.

Roman Perepelitsa wrote:
I've encountered fusion's behavior that seems to be a bug.
Jeez, thanks for spotting. I wonder how that got through! Fixed and test added. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
participants (2)
-
Joel de Guzman
-
Roman Perepelitsa