diff --git a/include/boost/fusion/adapted/array/tag_of.hpp b/include/boost/fusion/adapted/array/tag_of.hpp index 62f81ea0..67a4f116 100644 --- a/include/boost/fusion/adapted/array/tag_of.hpp +++ b/include/boost/fusion/adapted/array/tag_of.hpp @@ -21,6 +21,7 @@ namespace boost namespace boost { namespace fusion { struct array_tag; + struct fusion_sequence_tag; namespace traits { @@ -36,4 +37,22 @@ namespace boost { namespace fusion } }} +namespace boost { namespace mpl +{ + template + struct sequence_tag; + + template + struct sequence_tag > + { + typedef fusion::fusion_sequence_tag type; + }; + + template + struct sequence_tag const> + { + typedef fusion::fusion_sequence_tag type; + }; +}} + #endif diff --git a/include/boost/fusion/adapted/boost_tuple/tag_of.hpp b/include/boost/fusion/adapted/boost_tuple/tag_of.hpp index efae06a2..1183082d 100644 --- a/include/boost/fusion/adapted/boost_tuple/tag_of.hpp +++ b/include/boost/fusion/adapted/boost_tuple/tag_of.hpp @@ -26,6 +26,7 @@ namespace boost { namespace tuples namespace boost { namespace fusion { struct boost_tuple_tag; + struct fusion_sequence_tag; namespace traits { @@ -60,4 +61,54 @@ namespace boost { namespace fusion } }} +namespace boost { namespace mpl +{ + template + struct sequence_tag; + + template < + class T0, class T1, class T2, class T3, class T4, + class T5, class T6, class T7, class T8, class T9 + > + struct sequence_tag > + { + typedef fusion::fusion_sequence_tag type; + }; + + template < + class T0, class T1, class T2, class T3, class T4, + class T5, class T6, class T7, class T8, class T9 + > + struct sequence_tag< + tuples::tuple const + > + { + typedef fusion::fusion_sequence_tag type; + }; + + template + struct sequence_tag > + { + typedef fusion::fusion_sequence_tag type; + }; + + template + struct sequence_tag const> + { + typedef fusion::fusion_sequence_tag type; + }; + + template <> + struct sequence_tag + { + typedef fusion::fusion_sequence_tag type; + }; + + template <> + struct sequence_tag + { + typedef fusion::fusion_sequence_tag type; + }; +}} + #endif diff --git a/include/boost/fusion/adapted/class/adapt_assoc_class.hpp b/include/boost/fusion/adapted/class/adapt_assoc_class.hpp index 11f40ade..3dbf4284 100644 --- a/include/boost/fusion/adapted/class/adapt_assoc_class.hpp +++ b/include/boost/fusion/adapted/class/adapt_assoc_class.hpp @@ -62,6 +62,25 @@ namespace boost { namespace fusion { namespace extension { typedef class_tag type; \ }; \ }}} \ + \ + namespace boost { namespace mpl \ + { \ + template \ + struct sequence_tag; \ + \ + template<> \ + struct sequence_tag \ + { \ + typedef fusion::fusion_sequence_tag type; \ + }; \ + \ + template<> \ + struct sequence_tag \ + { \ + typedef fusion::fusion_sequence_tag type; \ + }; \ + }} \ + \ namespace boost { namespace fusion { namespace extension \ { \ template <> \ diff --git a/include/boost/fusion/adapted/class/adapt_class.hpp b/include/boost/fusion/adapted/class/adapt_class.hpp index c4e5c29f..0bfa13df 100644 --- a/include/boost/fusion/adapted/class/adapt_class.hpp +++ b/include/boost/fusion/adapted/class/adapt_class.hpp @@ -52,6 +52,25 @@ typedef class_tag type; \ }; \ }}} \ + \ + namespace boost { namespace mpl \ + { \ + template \ + struct sequence_tag; \ + \ + template<> \ + struct sequence_tag \ + { \ + typedef fusion::fusion_sequence_tag type; \ + }; \ + \ + template<> \ + struct sequence_tag \ + { \ + typedef fusion::fusion_sequence_tag type; \ + }; \ + }} \ + \ namespace boost { namespace fusion { namespace extension \ { \ template <> \ diff --git a/include/boost/fusion/adapted/class/extension.hpp b/include/boost/fusion/adapted/class/extension.hpp index b827e7ff..71fdc94c 100644 --- a/include/boost/fusion/adapted/class/extension.hpp +++ b/include/boost/fusion/adapted/class/extension.hpp @@ -10,46 +10,51 @@ #include -namespace boost { namespace fusion { namespace extension +namespace boost { namespace fusion { - template - struct class_member; + struct fusion_sequence_tag; - template - struct class_size; - - template - struct class_member : class_member {}; - - template - struct class_size - : class_size - {}; - - struct no_such_member; - - template - struct class_assoc_member + namespace extension { - typedef no_such_member type; - }; + template + struct class_member; - template - struct class_assoc_member - { - typedef typename - add_const::type>::type - type; + template + struct class_size; - static type& - call(Class const& class_) + template + struct class_member : class_member {}; + + template + struct class_size + : class_size + {}; + + struct no_such_member; + + template + struct class_assoc_member { - return class_assoc_member::call( - const_cast(class_)); - } - }; + typedef no_such_member type; + }; -}}} + template + struct class_assoc_member + { + typedef typename + add_const::type>::type + type; + + static type& + call(Class const& class_) + { + return class_assoc_member::call( + const_cast(class_)); + } + }; + + } +}} #endif diff --git a/include/boost/fusion/adapted/std_pair.hpp b/include/boost/fusion/adapted/std_pair.hpp index ffc343bc..0c87084c 100644 --- a/include/boost/fusion/adapted/std_pair.hpp +++ b/include/boost/fusion/adapted/std_pair.hpp @@ -16,6 +16,7 @@ namespace boost { namespace fusion { struct struct_tag; + struct fusion_sequence_tag; namespace traits { @@ -29,42 +30,60 @@ namespace boost { namespace fusion typedef struct_tag type; }; } - - namespace extension - { - template - struct struct_member; - - template - struct struct_size; - - template - struct struct_member, 0> - { - typedef T1 type; - - static type& call(std::pair& pair) - { - return pair.first; - } - }; - - template - struct struct_member, 1> - { - typedef T2 type; - - static type& call(std::pair& pair) - { - return pair.second; - } - }; - - template - struct struct_size > : mpl::int_<2> - { - }; - } }} +namespace boost { namespace mpl +{ + template + struct sequence_tag; + + template + struct sequence_tag > + { + typedef fusion::fusion_sequence_tag type; + }; + + template + struct sequence_tag const> + { + typedef fusion::fusion_sequence_tag type; + }; +}} + +namespace boost { namespace fusion { namespace extension +{ + template + struct struct_member; + + template + struct struct_size; + + template + struct struct_member, 0> + { + typedef T1 type; + + static type& call(std::pair& pair) + { + return pair.first; + } + }; + + template + struct struct_member, 1> + { + typedef T2 type; + + static type& call(std::pair& pair) + { + return pair.second; + } + }; + + template + struct struct_size > : mpl::int_<2> + { + }; +}}} + #endif diff --git a/include/boost/fusion/adapted/std_pair/tag_of.hpp b/include/boost/fusion/adapted/std_pair/tag_of.hpp index 7b63d287..2d4faaa5 100644 --- a/include/boost/fusion/adapted/std_pair/tag_of.hpp +++ b/include/boost/fusion/adapted/std_pair/tag_of.hpp @@ -15,6 +15,7 @@ namespace boost { namespace fusion { struct std_pair_tag; + struct fusion_sequence_tag; namespace traits { @@ -26,4 +27,22 @@ namespace boost { namespace fusion { } }} +namespace boost { namespace mpl +{ + template + struct sequence_tag; + + template + struct sequence_tag > + { + typedef fusion::fusion_sequence_tag type; + }; + + template + struct sequence_tag const> + { + typedef fusion::fusion_sequence_tag type; + }; +}} + #endif diff --git a/include/boost/fusion/adapted/struct/adapt_assoc_struct.hpp b/include/boost/fusion/adapted/struct/adapt_assoc_struct.hpp index e8ee31b9..5061fe36 100644 --- a/include/boost/fusion/adapted/struct/adapt_assoc_struct.hpp +++ b/include/boost/fusion/adapted/struct/adapt_assoc_struct.hpp @@ -62,6 +62,25 @@ namespace boost { namespace fusion { namespace extension { typedef struct_tag type; \ }; \ }}} \ + \ + namespace boost { namespace mpl \ + { \ + template \ + struct sequence_tag; \ + \ + template<> \ + struct sequence_tag \ + { \ + typedef fusion::fusion_sequence_tag type; \ + }; \ + \ + template<> \ + struct sequence_tag \ + { \ + typedef fusion::fusion_sequence_tag type; \ + }; \ + }} \ + \ namespace boost { namespace fusion { namespace extension \ { \ template <> \ diff --git a/include/boost/fusion/adapted/struct/adapt_struct.hpp b/include/boost/fusion/adapted/struct/adapt_struct.hpp index 41de5b1e..88122aff 100644 --- a/include/boost/fusion/adapted/struct/adapt_struct.hpp +++ b/include/boost/fusion/adapted/struct/adapt_struct.hpp @@ -52,6 +52,25 @@ typedef struct_tag type; \ }; \ }}} \ + \ + namespace boost { namespace mpl \ + { \ + template \ + struct sequence_tag; \ + \ + template<> \ + struct sequence_tag \ + { \ + typedef fusion::fusion_sequence_tag type; \ + }; \ + \ + template<> \ + struct sequence_tag \ + { \ + typedef fusion::fusion_sequence_tag type; \ + }; \ + }} \ + \ namespace boost { namespace fusion { namespace extension \ { \ template <> \ diff --git a/include/boost/fusion/adapted/struct/extension.hpp b/include/boost/fusion/adapted/struct/extension.hpp index 071b11e9..6f5de9ea 100644 --- a/include/boost/fusion/adapted/struct/extension.hpp +++ b/include/boost/fusion/adapted/struct/extension.hpp @@ -10,58 +10,63 @@ #include -namespace boost { namespace fusion { namespace extension +namespace boost { namespace fusion { - template - struct struct_member; + struct fusion_sequence_tag; - template - struct struct_size; - - template - struct struct_member + namespace extension { - typedef typename - add_const::type>::type - type; + template + struct struct_member; - static type& - call(Struct const& struct_) + template + struct struct_size; + + template + struct struct_member { - return struct_member::call( - const_cast(struct_)); - } - }; + typedef typename + add_const::type>::type + type; - template - struct struct_size - : struct_size - {}; + static type& + call(Struct const& struct_) + { + return struct_member::call( + const_cast(struct_)); + } + }; - struct no_such_member; + template + struct struct_size + : struct_size + {}; - template - struct struct_assoc_member - { - typedef no_such_member type; - }; + struct no_such_member; - template - struct struct_assoc_member - { - typedef typename - add_const::type>::type - type; - - static type& - call(Struct const& struct_) + template + struct struct_assoc_member { - return struct_assoc_member::call( - const_cast(struct_)); - } - }; + typedef no_such_member type; + }; -}}} + template + struct struct_assoc_member + { + typedef typename + add_const::type>::type + type; + + static type& + call(Struct const& struct_) + { + return struct_assoc_member::call( + const_cast(struct_)); + } + }; + + } +}} #endif diff --git a/test/sequence/adapt_assoc_struct.cpp b/test/sequence/adapt_assoc_struct.cpp index acab2b97..7fe5e35b 100644 --- a/test/sequence/adapt_assoc_struct.cpp +++ b/test/sequence/adapt_assoc_struct.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -26,7 +27,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -126,6 +130,13 @@ main() BOOST_TEST(at_key(p) == 3); } + { + BOOST_MPL_ASSERT((mpl::is_sequence)); + BOOST_MPL_ASSERT((boost::is_same< + fusion::result_of::value_at_c::type + , mpl::front::type>)); + } + return boost::report_errors(); } diff --git a/test/sequence/adapt_class.cpp b/test/sequence/adapt_class.cpp index fd9b38c5..d0081808 100644 --- a/test/sequence/adapt_class.cpp +++ b/test/sequence/adapt_class.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -22,7 +23,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -113,6 +117,13 @@ main() l = p; } + { + BOOST_MPL_ASSERT((mpl::is_sequence)); + BOOST_MPL_ASSERT((boost::is_same< + fusion::result_of::value_at_c::type + , mpl::front::type>)); + } + return boost::report_errors(); } diff --git a/test/sequence/adapt_struct.cpp b/test/sequence/adapt_struct.cpp index 2d208b57..981b9c13 100644 --- a/test/sequence/adapt_struct.cpp +++ b/test/sequence/adapt_struct.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -22,7 +23,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -114,6 +118,14 @@ main() BOOST_MPL_ASSERT((is_same::type, e>)); } + + { + BOOST_MPL_ASSERT((mpl::is_sequence)); + BOOST_MPL_ASSERT((boost::is_same< + fusion::result_of::value_at_c::type + , mpl::front::type>)); + } + return boost::report_errors(); } diff --git a/test/sequence/array.cpp b/test/sequence/array.cpp index 0ca5255d..07b5f48e 100644 --- a/test/sequence/array.cpp +++ b/test/sequence/array.cpp @@ -15,8 +15,12 @@ #include #include #include +#include +#include +#include #include +#include int main() { @@ -37,5 +41,8 @@ int main() BOOST_TEST(size(arr) == 3); BOOST_TEST(distance(begin(arr), end(arr)) == 3); + BOOST_MPL_ASSERT((boost::mpl::is_sequence)); + BOOST_MPL_ASSERT((boost::is_same::type>)); + return boost::report_errors(); } diff --git a/test/sequence/boost_tuple.cpp b/test/sequence/boost_tuple.cpp index c3949cbf..ef5dfa3b 100644 --- a/test/sequence/boost_tuple.cpp +++ b/test/sequence/boost_tuple.cpp @@ -23,8 +23,11 @@ #include #include #include +#include #include #include +#include +#include #include #include #include @@ -96,6 +99,12 @@ main() BOOST_TEST(2u == fusion::distance(fusion::begin(t), fusion::end(t))); } + { + typedef boost::tuple tuple_type; + BOOST_MPL_ASSERT((mpl::is_sequence)); + BOOST_MPL_ASSERT((boost::is_same::type>)); + } + return boost::report_errors(); } diff --git a/test/sequence/std_pair.cpp b/test/sequence/std_pair.cpp index b5c18d17..0a704753 100644 --- a/test/sequence/std_pair.cpp +++ b/test/sequence/std_pair.cpp @@ -22,7 +22,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -86,6 +89,12 @@ main() l = std::make_pair(123, "Hola!!!"); } + { + typedef std::pair pair_type; + BOOST_MPL_ASSERT((mpl::is_sequence)); + BOOST_MPL_ASSERT((boost::is_same::type>)); + } + return boost::report_errors(); }