Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62889 - trunk/boost/fusion/iterator/mpl
From: steven_at_[hidden]
Date: 2010-06-12 21:22:43


Author: steven_watanabe
Date: 2010-06-12 21:22:41 EDT (Sat, 12 Jun 2010)
New Revision: 62889
URL: http://svn.boost.org/trac/boost/changeset/62889

Log:
Translate fusion iterator categories to MPL iteraotr categories for fusion_iterator. Fixes #3204.
Text files modified:
   trunk/boost/fusion/iterator/mpl/fusion_iterator.hpp | 24 +++++++++++++++++++++++-
   1 files changed, 23 insertions(+), 1 deletions(-)

Modified: trunk/boost/fusion/iterator/mpl/fusion_iterator.hpp
==============================================================================
--- trunk/boost/fusion/iterator/mpl/fusion_iterator.hpp (original)
+++ trunk/boost/fusion/iterator/mpl/fusion_iterator.hpp 2010-06-12 21:22:41 EDT (Sat, 12 Jun 2010)
@@ -16,6 +16,27 @@
 #include <boost/mpl/next_prior.hpp>
 #include <boost/mpl/advance_fwd.hpp>
 #include <boost/mpl/distance_fwd.hpp>
+#include <boost/mpl/iterator_tags.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/type_traits/is_base_of.hpp>
+
+namespace boost { namespace fusion { namespace detail
+{
+
+template<class Category>
+struct to_mpl_category {
+ typedef typename mpl::eval_if<
+ is_base_of<random_access_traversal_tag, Category>,
+ mpl::random_access_iterator_tag,
+ mpl::eval_if<
+ is_base_of<bidirectional_traversal_tag, Category>,
+ mpl::bidirectional_iterator_tag,
+ mpl::forward_iterator_tag
+ >
+ >::type type;
+};
+
+}}}
 
 namespace boost { namespace mpl
 {
@@ -23,7 +44,8 @@
     struct fusion_iterator
     {
         typedef typename fusion::result_of::value_of<Iterator>::type type;
- typedef typename fusion::traits::category_of<Iterator>::type category;
+ typedef typename fusion::traits::category_of<Iterator>::type fusion_category;
+ typedef typename fusion::detail::to_mpl_category<fusion_category>::type category;
         typedef Iterator iterator;
     };
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk