Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73771 - in trunk/boost: fusion/container/ext_ fusion/sequence/intrinsic/ext_ fusion/view/ext_ fusion/view/ext_/detail proto
From: eric_at_[hidden]
Date: 2011-08-15 02:53:40


Author: eric_niebler
Date: 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
New Revision: 73771
URL: http://svn.boost.org/trac/boost/changeset/73771

Log:
naming tweaks
Added:
   trunk/boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp
      - copied, changed from r73770, /trunk/boost/fusion/sequence/intrinsic/ext_/size_s.hpp
Removed:
   trunk/boost/fusion/sequence/intrinsic/ext_/size_s.hpp
Text files modified:
   trunk/boost/fusion/container/ext_/tree.hpp | 2 +-
   trunk/boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp | 4 ++--
   trunk/boost/fusion/view/ext_/detail/next_impl.hpp | 35 ++++++++++++++++++++++++++---------
   trunk/boost/fusion/view/ext_/detail/segment_sequence.hpp | 2 +-
   trunk/boost/fusion/view/ext_/segmented_begin.hpp | 2 +-
   trunk/boost/fusion/view/ext_/segmented_end.hpp | 2 +-
   trunk/boost/fusion/view/ext_/segmented_iterator.hpp | 34 +++++++++++++++++-----------------
   trunk/boost/fusion/view/ext_/segmented_iterator_range.hpp | 12 ++++++------
   trunk/boost/proto/fusion.hpp | 2 +-
   9 files changed, 56 insertions(+), 39 deletions(-)

Modified: trunk/boost/fusion/container/ext_/tree.hpp
==============================================================================
--- trunk/boost/fusion/container/ext_/tree.hpp (original)
+++ trunk/boost/fusion/container/ext_/tree.hpp 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
@@ -20,7 +20,7 @@
 #include <boost/fusion/support/sequence_base.hpp>
 #include <boost/fusion/support/category_of.hpp>
 #include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
-#include <boost/fusion/sequence/intrinsic/ext_/size_s.hpp>
+#include <boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp>
 #include <boost/fusion/support/ext_/is_segmented.hpp>
 #include <boost/fusion/view/ext_/segmented_iterator.hpp>
 #include <boost/fusion/view/ext_/segmented_begin.hpp>

Copied: trunk/boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp (from r73770, /trunk/boost/fusion/sequence/intrinsic/ext_/size_s.hpp)
==============================================================================
--- /trunk/boost/fusion/sequence/intrinsic/ext_/size_s.hpp (original)
+++ trunk/boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
@@ -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 <boost/type_traits/add_const.hpp>
 #include <boost/type_traits/remove_reference.hpp>

Deleted: trunk/boost/fusion/sequence/intrinsic/ext_/size_s.hpp
==============================================================================
--- trunk/boost/fusion/sequence/intrinsic/ext_/size_s.hpp 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
+++ (empty file)
@@ -1,60 +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_SIZE_S_08112006_1141)
-#define BOOST_FUSION_SIZE_S_08112006_1141
-
-#include <boost/type_traits/add_const.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/mpl/fold.hpp>
-#include <boost/mpl/plus.hpp>
-#include <boost/mpl/size_t.hpp>
-#include <boost/mpl/placeholders.hpp>
-#include <boost/fusion/mpl/begin.hpp>
-#include <boost/fusion/mpl/end.hpp>
-#include <boost/fusion/mpl/clear.hpp>
-#include <boost/fusion/mpl/push_front.hpp>
-#include <boost/fusion/sequence/intrinsic/size.hpp>
-#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
-#include <boost/fusion/support/ext_/is_segmented.hpp>
-
-namespace boost { namespace fusion
-{
- ///////////////////////////////////////////////////////////////////////////
- // calculates the size of any segmented data structure.
- template<typename Sequence>
- struct segmented_size;
-
- namespace detail
- {
- ///////////////////////////////////////////////////////////////////////////
- template<typename Sequence, bool IsSegmented = traits::is_segmented<Sequence>::value>
- struct segmented_size_impl
- : mpl::fold<
- typename remove_reference<
- typename add_const<
- typename result_of::segments<Sequence>::type
- >::type
- >::type,
- mpl::size_t<0>,
- mpl::plus<mpl::_1, segmented_size<mpl::_2> >
- >::type
- {};
-
- template<typename Sequence>
- struct segmented_size_impl<Sequence, false>
- : result_of::size<Sequence>::type
- {};
- }
-
- template<typename Sequence>
- struct segmented_size
- : detail::segmented_size_impl<Sequence>
- {};
-
-}}
-
-#endif

Modified: trunk/boost/fusion/view/ext_/detail/next_impl.hpp
==============================================================================
--- trunk/boost/fusion/view/ext_/detail/next_impl.hpp (original)
+++ trunk/boost/fusion/view/ext_/detail/next_impl.hpp 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
@@ -9,15 +9,18 @@
 
 #include <boost/type_traits/add_const.hpp>
 #include <boost/type_traits/remove_reference.hpp>
-#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
 #include <boost/fusion/container/list/cons.hpp>
+#include <boost/fusion/iterator/next.hpp>
 #include <boost/fusion/iterator/deref.hpp>
-#include <boost/fusion/algorithm/transformation/pop_front.hpp>
 #include <boost/fusion/view/ext_/detail/begin_impl.hpp>
 
 namespace boost { namespace fusion
 {
- template<typename Nodes>
+ template<typename First, typename Second>
+ struct iterator_range;
+
+ template<typename Context>
     struct segmented_iterator;
 
     namespace detail
@@ -29,7 +32,10 @@
 
         template<typename Stack>
         struct is_invalid
- : result_of::empty<typename Stack::car_type>
+ : 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 @@
         ////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<typename Stack>
         struct pop_front_car
         {
- typedef typename Stack::car_type car_type;
- typedef typename result_of::pop_front<car_type>::type new_car_type;
- typedef cons<new_car_type, typename Stack::cdr_type> 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<car_type, typename Stack::cdr_type>
+ 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);
             }
         };
 

Modified: trunk/boost/fusion/view/ext_/detail/segment_sequence.hpp
==============================================================================
--- trunk/boost/fusion/view/ext_/detail/segment_sequence.hpp (original)
+++ trunk/boost/fusion/view/ext_/detail/segment_sequence.hpp 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
@@ -11,7 +11,7 @@
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/fusion/support/tag_of.hpp>
 #include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
-#include <boost/fusion/sequence/intrinsic/ext_/size_s.hpp>
+#include <boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp>
 
 namespace boost { namespace fusion
 {

Modified: trunk/boost/fusion/view/ext_/segmented_begin.hpp
==============================================================================
--- trunk/boost/fusion/view/ext_/segmented_begin.hpp (original)
+++ trunk/boost/fusion/view/ext_/segmented_begin.hpp 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
@@ -11,7 +11,7 @@
 
 namespace boost { namespace fusion
 {
- template<typename Nodes>
+ template<typename Context>
     struct segmented_iterator;
 
     //auto segmented_begin( rng )

Modified: trunk/boost/fusion/view/ext_/segmented_end.hpp
==============================================================================
--- trunk/boost/fusion/view/ext_/segmented_end.hpp (original)
+++ trunk/boost/fusion/view/ext_/segmented_end.hpp 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
@@ -12,7 +12,7 @@
 
 namespace boost { namespace fusion
 {
- template<typename Nodes>
+ template<typename Context>
     struct segmented_iterator;
 
     //auto segmented_end( rng )

Modified: trunk/boost/fusion/view/ext_/segmented_iterator.hpp
==============================================================================
--- trunk/boost/fusion/view/ext_/segmented_iterator.hpp (original)
+++ trunk/boost/fusion/view/ext_/segmented_iterator.hpp 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
@@ -15,43 +15,43 @@
 #include <boost/fusion/mpl/clear.hpp>
 #include <boost/fusion/mpl/push_front.hpp>
 #include <boost/fusion/iterator/iterator_facade.hpp>
-#include <boost/fusion/view/ext_/detail/next_impl.hpp>
 #include <boost/fusion/iterator/deref.hpp>
 #include <boost/fusion/iterator/equal_to.hpp>
 #include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/view/ext_/detail/next_impl.hpp>
 #include <boost/fusion/view/ext_/segmented_begin.hpp>
 #include <boost/fusion/view/ext_/segmented_end.hpp>
 #include <boost/fusion/container/vector/convert.hpp>
 
 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<typename Nodes>
+ // 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<typename Context>
     struct segmented_iterator
- : iterator_facade<segmented_iterator<Nodes>, forward_traversal_tag>
+ : iterator_facade<segmented_iterator<Context>, 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<typename It>
         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 @@
         struct equal_to
             : mpl::equal<
                 typename mpl::reverse_transform<
- typename result_of::as_vector<typename It1::nodes_type>::type,
+ typename result_of::as_vector<typename It1::context_type>::type,
                     result_of::begin<mpl::_1>
>::type,
                 typename mpl::reverse_transform<
- typename result_of::as_vector<typename It2::nodes_type>::type,
+ typename result_of::as_vector<typename It2::context_type>::type,
                     result_of::begin<mpl::_1>
>::type,
                 result_of::equal_to<mpl::_1, mpl::_2>
@@ -75,17 +75,17 @@
         template<typename It>
         struct next
         {
- typedef detail::segmented_next_impl<typename It::nodes_type> impl;
+ typedef detail::segmented_next_impl<typename It::context_type> impl;
             typedef segmented_iterator<typename impl::type> 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;
     };
 
 }}

Modified: trunk/boost/fusion/view/ext_/segmented_iterator_range.hpp
==============================================================================
--- trunk/boost/fusion/view/ext_/segmented_iterator_range.hpp (original)
+++ trunk/boost/fusion/view/ext_/segmented_iterator_range.hpp 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
@@ -16,7 +16,7 @@
 #include <boost/fusion/iterator/next.hpp>
 #include <boost/fusion/iterator/deref.hpp>
 #include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
-#include <boost/fusion/sequence/intrinsic/ext_/size_s.hpp>
+#include <boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp>
 #include <boost/fusion/algorithm/transformation/push_back.hpp>
 #include <boost/fusion/algorithm/transformation/push_front.hpp>
 #include <boost/fusion/view/iterator_range.hpp>
@@ -475,14 +475,14 @@
 
     //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<typename Begin, typename End>
     struct make_segmented_range
     {
- typedef reverse_cons<typename Begin::nodes_type> reverse_begin_cons;
- typedef reverse_cons<typename End::nodes_type> reverse_end_cons;
+ typedef reverse_cons<typename Begin::context_type> reverse_begin_cons;
+ typedef reverse_cons<typename End::context_type> reverse_end_cons;
 
         typedef
             make_segmented_range_reduce<
@@ -496,8 +496,8 @@
         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));
         }
     };
 

Modified: trunk/boost/proto/fusion.hpp
==============================================================================
--- trunk/boost/proto/fusion.hpp (original)
+++ trunk/boost/proto/fusion.hpp 2011-08-15 02:53:35 EDT (Mon, 15 Aug 2011)
@@ -24,7 +24,7 @@
 #include <boost/fusion/include/transform_view.hpp>
 #include <boost/fusion/support/ext_/is_segmented.hpp>
 #include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
-#include <boost/fusion/sequence/intrinsic/ext_/size_s.hpp>
+#include <boost/fusion/sequence/intrinsic/ext_/segmented_size.hpp>
 #include <boost/fusion/sequence/comparison/enable_comparison.hpp>
 #include <boost/fusion/view/ext_/segmented_iterator.hpp>
 #include <boost/proto/proto_fwd.hpp>


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