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/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>

View File

@ -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>

View File

@ -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 @@ namespace boost { namespace fusion
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 @@ 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<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);
}
};

View File

@ -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
{

View File

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

View File

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

View File

@ -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 @@ namespace boost { namespace fusion
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 @@ namespace boost { namespace fusion
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;
};
}}

View File

@ -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 @@ 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<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 @@ 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));
}
};