naming tweaks

[SVN r73771]
This commit is contained in:
Eric Niebler
2011-08-15 06:53:35 +00:00
parent 9ed1f3d606
commit afbda073a3
8 changed files with 55 additions and 38 deletions

View File

@ -20,7 +20,7 @@
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/category_of.hpp> #include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/sequence/intrinsic/ext_/segments.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/support/ext_/is_segmented.hpp>
#include <boost/fusion/view/ext_/segmented_iterator.hpp> #include <boost/fusion/view/ext_/segmented_iterator.hpp>
#include <boost/fusion/view/ext_/segmented_begin.hpp> #include <boost/fusion/view/ext_/segmented_begin.hpp>

View File

@ -4,8 +4,8 @@
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#if !defined(BOOST_FUSION_SIZE_S_08112006_1141) #if !defined(BOOST_FUSION_SEGMENTED_SIZE_08112006_1141)
#define BOOST_FUSION_SIZE_S_08112006_1141 #define BOOST_FUSION_SEGMENTED_SIZE_08112006_1141
#include <boost/type_traits/add_const.hpp> #include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/remove_reference.hpp> #include <boost/type_traits/remove_reference.hpp>

View File

@ -9,15 +9,18 @@
#include <boost/type_traits/add_const.hpp> #include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/remove_reference.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/container/list/cons.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/algorithm/transformation/pop_front.hpp>
#include <boost/fusion/view/ext_/detail/begin_impl.hpp> #include <boost/fusion/view/ext_/detail/begin_impl.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
template<typename Nodes> template<typename First, typename Second>
struct iterator_range;
template<typename Context>
struct segmented_iterator; struct segmented_iterator;
namespace detail namespace detail
@ -29,7 +32,10 @@ namespace boost { namespace fusion
template<typename Stack> template<typename Stack>
struct is_invalid 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 ////Advance the first iterator in the range at the
@ -37,19 +43,30 @@ namespace boost { namespace fusion
////new stack. ////new stack.
//auto pop_front_car(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> template<typename Stack>
struct pop_front_car struct pop_front_car
{ {
typedef typename Stack::car_type car_type; typedef
typedef typename result_of::pop_front<car_type>::type new_car_type; iterator_range<
typedef cons<new_car_type, typename Stack::cdr_type> type; 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) 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);
} }
}; };

View File

@ -11,7 +11,7 @@
#include <boost/type_traits/remove_reference.hpp> #include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/support/tag_of.hpp> #include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/sequence/intrinsic/ext_/segments.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 namespace boost { namespace fusion
{ {

View File

@ -11,7 +11,7 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
template<typename Nodes> template<typename Context>
struct segmented_iterator; struct segmented_iterator;
//auto segmented_begin( rng ) //auto segmented_begin( rng )

View File

@ -12,7 +12,7 @@
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
template<typename Nodes> template<typename Context>
struct segmented_iterator; struct segmented_iterator;
//auto segmented_end( rng ) //auto segmented_end( rng )

View File

@ -15,43 +15,43 @@
#include <boost/fusion/mpl/clear.hpp> #include <boost/fusion/mpl/clear.hpp>
#include <boost/fusion/mpl/push_front.hpp> #include <boost/fusion/mpl/push_front.hpp>
#include <boost/fusion/iterator/iterator_facade.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/deref.hpp>
#include <boost/fusion/iterator/equal_to.hpp> #include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/sequence/intrinsic/begin.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_begin.hpp>
#include <boost/fusion/view/ext_/segmented_end.hpp> #include <boost/fusion/view/ext_/segmented_end.hpp>
#include <boost/fusion/container/vector/convert.hpp> #include <boost/fusion/container/vector/convert.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
// A segmented iterator is a stack of segment nodes. // A segmented iterator wraps a "context", which is a cons list
// Note: push_front/pop_front create views. That should // of ranges, the frontmost is range over values and the rest
// be good enough. // are ranges over internal segments.
template<typename Nodes> template<typename Context>
struct segmented_iterator 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) explicit segmented_iterator(Context const& ctx)
: nodes(ns) : context(ctx)
{} {}
//auto deref(it) //auto deref(it)
//{ //{
// return deref(begin(car(it.nodes))) // return deref(begin(car(it.context)))
//} //}
template<typename It> template<typename It>
struct deref struct deref
{ {
typedef typedef
typename result_of::deref< typename result_of::deref<
typename It::nodes_type::car_type::begin_type typename It::context_type::car_type::begin_type
>::type >::type
type; type;
static type call(It const& it) 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 struct equal_to
: mpl::equal< : mpl::equal<
typename mpl::reverse_transform< 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> result_of::begin<mpl::_1>
>::type, >::type,
typename mpl::reverse_transform< 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> result_of::begin<mpl::_1>
>::type, >::type,
result_of::equal_to<mpl::_1, mpl::_2> result_of::equal_to<mpl::_1, mpl::_2>
@ -75,17 +75,17 @@ namespace boost { namespace fusion
template<typename It> template<typename It>
struct next 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; typedef segmented_iterator<typename impl::type> type;
static type call(It const& it) static type call(It const& it)
{ {
return type(impl::call(it.nodes)); return type(impl::call(it.context));
} }
}; };
typedef Nodes nodes_type; typedef Context context_type;
nodes_type nodes; context_type context;
}; };
}} }}

View File

@ -16,7 +16,7 @@
#include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/sequence/intrinsic/ext_/segments.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_back.hpp>
#include <boost/fusion/algorithm/transformation/push_front.hpp> #include <boost/fusion/algorithm/transformation/push_front.hpp>
#include <boost/fusion/view/iterator_range.hpp> #include <boost/fusion/view/iterator_range.hpp>
@ -475,14 +475,14 @@ namespace boost { namespace fusion { namespace detail
//auto make_segmented_range(begin, end) //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> template<typename Begin, typename End>
struct make_segmented_range struct make_segmented_range
{ {
typedef reverse_cons<typename Begin::nodes_type> reverse_begin_cons; typedef reverse_cons<typename Begin::context_type> reverse_begin_cons;
typedef reverse_cons<typename End::nodes_type> reverse_end_cons; typedef reverse_cons<typename End::context_type> reverse_end_cons;
typedef typedef
make_segmented_range_reduce< make_segmented_range_reduce<
@ -496,8 +496,8 @@ namespace boost { namespace fusion { namespace detail
static type call(Begin const & begin, End const & end) static type call(Begin const & begin, End const & end)
{ {
return impl::call( return impl::call(
reverse_begin_cons::call(begin.nodes), reverse_begin_cons::call(begin.context),
reverse_end_cons::call(end.nodes)); reverse_end_cons::call(end.context));
} }
}; };