From afbda073a3ac1eecadd1b2e93c099966b73ee836 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Mon, 15 Aug 2011 06:53:35 +0000 Subject: [PATCH] naming tweaks [SVN r73771] --- include/boost/fusion/container/ext_/tree.hpp | 2 +- .../ext_/{size_s.hpp => segmented_size.hpp} | 4 +-- .../fusion/view/ext_/detail/next_impl.hpp | 35 ++++++++++++++----- .../view/ext_/detail/segment_sequence.hpp | 2 +- .../fusion/view/ext_/segmented_begin.hpp | 2 +- .../boost/fusion/view/ext_/segmented_end.hpp | 2 +- .../fusion/view/ext_/segmented_iterator.hpp | 34 +++++++++--------- .../view/ext_/segmented_iterator_range.hpp | 12 +++---- 8 files changed, 55 insertions(+), 38 deletions(-) rename include/boost/fusion/sequence/intrinsic/ext_/{size_s.hpp => segmented_size.hpp} (94%) diff --git a/include/boost/fusion/container/ext_/tree.hpp b/include/boost/fusion/container/ext_/tree.hpp index 1958df3c..d1e777d0 100644 --- a/include/boost/fusion/container/ext_/tree.hpp +++ b/include/boost/fusion/container/ext_/tree.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp b/include/boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp similarity index 94% rename from include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp rename to include/boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp index 1a1d9c5f..721756c4 100644 --- a/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp +++ b/include/boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp @@ -4,8 +4,8 @@ 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_SIZE_S_08112006_1141) -#define BOOST_FUSION_SIZE_S_08112006_1141 +#if !defined(BOOST_FUSION_SEGMENTED_SIZE_08112006_1141) +#define BOOST_FUSION_SEGMENTED_SIZE_08112006_1141 #include #include diff --git a/include/boost/fusion/view/ext_/detail/next_impl.hpp b/include/boost/fusion/view/ext_/detail/next_impl.hpp index d3817c59..7428d2ac 100644 --- a/include/boost/fusion/view/ext_/detail/next_impl.hpp +++ b/include/boost/fusion/view/ext_/detail/next_impl.hpp @@ -9,15 +9,18 @@ #include #include -#include +#include #include +#include #include -#include #include namespace boost { namespace fusion { - template + template + struct iterator_range; + + template struct segmented_iterator; namespace detail @@ -29,7 +32,10 @@ namespace boost { namespace fusion template struct is_invalid - : result_of::empty + : result_of::equal_to< + typename Stack::car_type::begin_type, + typename Stack::car_type::end_type + > {}; ////Advance the first iterator in the range at the @@ -37,19 +43,30 @@ namespace boost { namespace fusion ////new stack. //auto pop_front_car(stack) //{ - // return cons(pop_front(car(stack)), cdr(stack)) + // return cons(iterator_range(next(begin(car(stack))), end(car(stack))), cdr(stack)); //} template struct pop_front_car { - typedef typename Stack::car_type car_type; - typedef typename result_of::pop_front::type new_car_type; - typedef cons type; + typedef + iterator_range< + typename result_of::next< + typename Stack::car_type::begin_type + >::type + , typename Stack::car_type::end_type + > + car_type; + + typedef + cons + type; static type call(Stack const & stack) { - return type(fusion::pop_front(stack.car), stack.cdr); + return type( + car_type(fusion::next(stack.car.first), stack.car.last), + stack.cdr); } }; diff --git a/include/boost/fusion/view/ext_/detail/segment_sequence.hpp b/include/boost/fusion/view/ext_/detail/segment_sequence.hpp index f68c31b8..cae4e5df 100644 --- a/include/boost/fusion/view/ext_/detail/segment_sequence.hpp +++ b/include/boost/fusion/view/ext_/detail/segment_sequence.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include namespace boost { namespace fusion { diff --git a/include/boost/fusion/view/ext_/segmented_begin.hpp b/include/boost/fusion/view/ext_/segmented_begin.hpp index a0aa12e2..7f36ae36 100644 --- a/include/boost/fusion/view/ext_/segmented_begin.hpp +++ b/include/boost/fusion/view/ext_/segmented_begin.hpp @@ -11,7 +11,7 @@ namespace boost { namespace fusion { - template + template struct segmented_iterator; //auto segmented_begin( rng ) diff --git a/include/boost/fusion/view/ext_/segmented_end.hpp b/include/boost/fusion/view/ext_/segmented_end.hpp index e9ace31f..ac52d149 100644 --- a/include/boost/fusion/view/ext_/segmented_end.hpp +++ b/include/boost/fusion/view/ext_/segmented_end.hpp @@ -12,7 +12,7 @@ namespace boost { namespace fusion { - template + template struct segmented_iterator; //auto segmented_end( rng ) diff --git a/include/boost/fusion/view/ext_/segmented_iterator.hpp b/include/boost/fusion/view/ext_/segmented_iterator.hpp index 4c259632..238e1679 100644 --- a/include/boost/fusion/view/ext_/segmented_iterator.hpp +++ b/include/boost/fusion/view/ext_/segmented_iterator.hpp @@ -15,43 +15,43 @@ #include #include #include -#include #include #include #include +#include #include #include #include namespace boost { namespace fusion { - // A segmented iterator is a stack of segment nodes. - // Note: push_front/pop_front create views. That should - // be good enough. - template + // A segmented iterator wraps a "context", which is a cons list + // of ranges, the frontmost is range over values and the rest + // are ranges over internal segments. + template struct segmented_iterator - : iterator_facade, forward_traversal_tag> + : iterator_facade, forward_traversal_tag> { - explicit segmented_iterator(Nodes const &ns) - : nodes(ns) + explicit segmented_iterator(Context const& ctx) + : context(ctx) {} //auto deref(it) //{ - // return deref(begin(car(it.nodes))) + // return deref(begin(car(it.context))) //} template struct deref { typedef typename result_of::deref< - typename It::nodes_type::car_type::begin_type + typename It::context_type::car_type::begin_type >::type type; static type call(It const& it) { - return *it.nodes.car.first; + return *it.context.car.first; } }; @@ -61,11 +61,11 @@ namespace boost { namespace fusion struct equal_to : mpl::equal< typename mpl::reverse_transform< - typename result_of::as_vector::type, + typename result_of::as_vector::type, result_of::begin >::type, typename mpl::reverse_transform< - typename result_of::as_vector::type, + typename result_of::as_vector::type, result_of::begin >::type, result_of::equal_to @@ -75,17 +75,17 @@ namespace boost { namespace fusion template struct next { - typedef detail::segmented_next_impl impl; + typedef detail::segmented_next_impl impl; typedef segmented_iterator type; static type call(It const& it) { - return type(impl::call(it.nodes)); + return type(impl::call(it.context)); } }; - typedef Nodes nodes_type; - nodes_type nodes; + typedef Context context_type; + context_type context; }; }} diff --git a/include/boost/fusion/view/ext_/segmented_iterator_range.hpp b/include/boost/fusion/view/ext_/segmented_iterator_range.hpp index 33fc0a5e..d8ab40ca 100644 --- a/include/boost/fusion/view/ext_/segmented_iterator_range.hpp +++ b/include/boost/fusion/view/ext_/segmented_iterator_range.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include @@ -475,14 +475,14 @@ namespace boost { namespace fusion { namespace detail //auto make_segmented_range(begin, end) //{ - // return make_segmented_range_reduce(reverse(begin.nodes), reverse(end.nodes)); + // return make_segmented_range_reduce(reverse(begin.context), reverse(end.context)); //} template struct make_segmented_range { - typedef reverse_cons reverse_begin_cons; - typedef reverse_cons reverse_end_cons; + typedef reverse_cons reverse_begin_cons; + typedef reverse_cons reverse_end_cons; typedef make_segmented_range_reduce< @@ -496,8 +496,8 @@ namespace boost { namespace fusion { namespace detail static type call(Begin const & begin, End const & end) { return impl::call( - reverse_begin_cons::call(begin.nodes), - reverse_end_cons::call(end.nodes)); + reverse_begin_cons::call(begin.context), + reverse_end_cons::call(end.context)); } };