diff --git a/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp b/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp index d152efe0..1a1d9c5f 100644 --- a/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp +++ b/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp @@ -13,7 +13,10 @@ #include #include #include -#include +#include +#include +#include +#include #include #include #include diff --git a/include/boost/fusion/view/ext_/detail/deref_impl.hpp b/include/boost/fusion/view/ext_/detail/deref_impl.hpp deleted file mode 100644 index 084aa521..00000000 --- a/include/boost/fusion/view/ext_/detail/deref_impl.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/*============================================================================= - Copyright (c) 2011 Eric Niebler - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -==============================================================================*/ -#if !defined(BOOST_FUSION_SEGMENTED_ITERATOR_DEREF_HPP_INCLUDED) -#define BOOST_FUSION_SEGMENTED_ITERATOR_DEREF_HPP_INCLUDED - -#include - -namespace boost { namespace fusion -{ - struct segmented_iterator_tag; - - namespace extension - { - template - struct deref_impl; - - //auto deref(it) - //{ - // return deref(begin(car(it.nodes))) - //} - template<> - struct deref_impl - { - template - struct apply - { - typedef - typename result_of::deref< - typename It::nodes_type::car_type::begin_type - >::type - type; - - static type call(It const& it) - { - return *it.nodes.car.first; - } - }; - }; - - } -}} - -#endif diff --git a/include/boost/fusion/view/ext_/detail/equal_to_impl.hpp b/include/boost/fusion/view/ext_/detail/equal_to_impl.hpp deleted file mode 100644 index 3b5bd7d5..00000000 --- a/include/boost/fusion/view/ext_/detail/equal_to_impl.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================= - Copyright (c) 2011 Eric Niebler - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -==============================================================================*/ -#if !defined(BOOST_FUSION_SEGMENTED_ITERATOR_EQUAL_TO_HPP_INCLUDED) -#define BOOST_FUSION_SEGMENTED_ITERATOR_EQUAL_TO_HPP_INCLUDED - -#include -#include -#include -#include -#include -#include -#include - -namespace boost { namespace fusion -{ - struct segmented_iterator_tag; - - namespace extension - { - template - struct equal_to_impl; - - template<> - struct equal_to_impl - { - // Compare all the segment iterators in each stack, starting with - // the bottom-most. - template - struct apply - : mpl::equal< - typename mpl::reverse_transform< - typename result_of::as_vector::type, - result_of::begin - >::type, - typename mpl::reverse_transform< - typename result_of::as_vector::type, - result_of::begin - >::type, - result_of::equal_to - > - {}; - }; - - } -}} - -#endif diff --git a/include/boost/fusion/view/ext_/detail/next_impl.hpp b/include/boost/fusion/view/ext_/detail/next_impl.hpp index 7341a319..d3817c59 100644 --- a/include/boost/fusion/view/ext_/detail/next_impl.hpp +++ b/include/boost/fusion/view/ext_/detail/next_impl.hpp @@ -17,8 +17,6 @@ namespace boost { namespace fusion { - struct segmented_iterator_tag; - template struct segmented_iterator; @@ -227,29 +225,6 @@ namespace boost { namespace fusion } }; } - - namespace extension - { - template - struct next_impl; - - template<> - struct next_impl - { - template - struct apply - { - typedef detail::segmented_next_impl impl; - typedef segmented_iterator type; - - static type call(It const& it) - { - return type(impl::call(it.nodes)); - } - }; - }; - - } }} #endif diff --git a/include/boost/fusion/view/ext_/segmented_iterator.hpp b/include/boost/fusion/view/ext_/segmented_iterator.hpp index cd454e27..4c259632 100644 --- a/include/boost/fusion/view/ext_/segmented_iterator.hpp +++ b/include/boost/fusion/view/ext_/segmented_iterator.hpp @@ -7,32 +7,83 @@ #if !defined(BOOST_FUSION_SEGMENTED_ITERATOR_HPP_INCLUDED) #define BOOST_FUSION_SEGMENTED_ITERATOR_HPP_INCLUDED -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include +#include +#include +#include #include #include +#include namespace boost { namespace fusion { - struct segmented_iterator_tag {}; - // A segmented iterator is a stack of segment nodes. // Note: push_front/pop_front create views. That should // be good enough. template struct segmented_iterator - : fusion::iterator_base > + : iterator_facade, forward_traversal_tag> { - typedef forward_traversal_tag category; - typedef segmented_iterator_tag fusion_tag; - explicit segmented_iterator(Nodes const &ns) : nodes(ns) {} + //auto deref(it) + //{ + // return deref(begin(car(it.nodes))) + //} + template + struct deref + { + typedef + typename result_of::deref< + typename It::nodes_type::car_type::begin_type + >::type + type; + + static type call(It const& it) + { + return *it.nodes.car.first; + } + }; + + // Compare all the segment iterators in each stack, starting with + // the bottom-most. + template + struct equal_to + : mpl::equal< + typename mpl::reverse_transform< + typename result_of::as_vector::type, + result_of::begin + >::type, + typename mpl::reverse_transform< + typename result_of::as_vector::type, + result_of::begin + >::type, + result_of::equal_to + > + {}; + + template + struct next + { + typedef detail::segmented_next_impl impl; + typedef segmented_iterator type; + + static type call(It const& it) + { + return type(impl::call(it.nodes)); + } + }; + typedef Nodes nodes_type; nodes_type nodes; }; diff --git a/include/boost/fusion/view/ext_/segmented_iterator_range.hpp b/include/boost/fusion/view/ext_/segmented_iterator_range.hpp index 4d80f67a..33fc0a5e 100644 --- a/include/boost/fusion/view/ext_/segmented_iterator_range.hpp +++ b/include/boost/fusion/view/ext_/segmented_iterator_range.hpp @@ -7,22 +7,20 @@ #if !defined(BOOST_FUSION_SEGMENTED_ITERATOR_RANGE_HPP_INCLUDED) #define BOOST_FUSION_SEGMENTED_ITERATOR_RANGE_HPP_INCLUDED -#include #include -#include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -35,6 +33,12 @@ // - The front of each range in the stack (besides the // topmost) is the range above it +namespace boost { namespace fusion +{ + template + struct segmented_iterator; +}} + namespace boost { namespace fusion { namespace detail { //auto make_segment_sequence_front(stack_begin) @@ -508,13 +512,28 @@ namespace boost { namespace fusion { namespace extension template<> struct is_segmented_impl { + private: template struct is_segmented_iterator - : is_same< - segmented_iterator_tag, - typename traits::tag_of::type> + : mpl::false_ {}; + template + struct is_segmented_iterator + : is_segmented_iterator + {}; + + template + struct is_segmented_iterator + : is_segmented_iterator + {}; + + template + struct is_segmented_iterator > + : mpl::true_ + {}; + + public: template struct apply : is_segmented_iterator