bug fixes to segmented fusion support, more fwd headers

[SVN r73927]
This commit is contained in:
Eric Niebler
2011-08-19 18:41:11 +00:00
parent eb903d71a7
commit def510808d
18 changed files with 286 additions and 22 deletions

View File

@ -7,6 +7,7 @@
#if !defined(FUSION_VECTOR10_05042005_0257) #if !defined(FUSION_VECTOR10_05042005_0257)
#define FUSION_VECTOR10_05042005_0257 #define FUSION_VECTOR10_05042005_0257
#include <boost/fusion/container/vector/vector10_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/next.hpp>
@ -39,7 +40,7 @@ namespace boost { namespace fusion
struct fusion_sequence_tag; struct fusion_sequence_tag;
struct random_access_traversal_tag; struct random_access_traversal_tag;
template <typename Dummy = void> template <typename Dummy>
struct vector0 : sequence_base<vector0<Dummy> > struct vector0 : sequence_base<vector0<Dummy> >
{ {
typedef mpl::vector0<> types; typedef mpl::vector0<> types;

View File

@ -0,0 +1,34 @@
#ifndef BOOST_PP_IS_ITERATING
/*=============================================================================
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_VECTOR10_FWD_HPP_INCLUDED)
#define BOOST_FUSION_VECTOR10_FWD_HPP_INCLUDED
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
namespace boost { namespace fusion
{
template <typename Dummy = void>
struct vector0;
// expand vector1 to vector10
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/vector10_fwd.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, 10)
#include BOOST_PP_ITERATE()
}}
#endif
#else
template <BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename T)>
struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION());
#endif

View File

@ -7,6 +7,7 @@
#if !defined(FUSION_VECTOR20_05052005_0205) #if !defined(FUSION_VECTOR20_05052005_0205)
#define FUSION_VECTOR20_05052005_0205 #define FUSION_VECTOR20_05052005_0205
#include <boost/fusion/container/vector/vector20_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/next.hpp>

View File

@ -0,0 +1,31 @@
#ifndef BOOST_PP_IS_ITERATING
/*=============================================================================
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_VECTOR20_FWD_HPP_INCLUDED)
#define BOOST_FUSION_VECTOR20_FWD_HPP_INCLUDED
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
namespace boost { namespace fusion
{
// expand vector11 to vector20
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/vector20_fwd.hpp>
#define BOOST_PP_ITERATION_LIMITS (11, 20)
#include BOOST_PP_ITERATE()
}}
#endif
#else
template <BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename T)>
struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION());
#endif

View File

@ -7,6 +7,7 @@
#if !defined(FUSION_VECTOR30_05052005_0206) #if !defined(FUSION_VECTOR30_05052005_0206)
#define FUSION_VECTOR30_05052005_0206 #define FUSION_VECTOR30_05052005_0206
#include <boost/fusion/container/vector/vector30_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/next.hpp>

View File

@ -0,0 +1,31 @@
#ifndef BOOST_PP_IS_ITERATING
/*=============================================================================
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_VECTOR30_FWD_HPP_INCLUDED)
#define BOOST_FUSION_VECTOR30_FWD_HPP_INCLUDED
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
namespace boost { namespace fusion
{
// expand vector21 to vector30
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/vector30_fwd.hpp>
#define BOOST_PP_ITERATION_LIMITS (21, 30)
#include BOOST_PP_ITERATE()
}}
#endif
#else
template <BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename T)>
struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION());
#endif

View File

@ -7,6 +7,7 @@
#if !defined(FUSION_VECTOR40_05052005_0208) #if !defined(FUSION_VECTOR40_05052005_0208)
#define FUSION_VECTOR40_05052005_0208 #define FUSION_VECTOR40_05052005_0208
#include <boost/fusion/container/vector/vector40_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/next.hpp>

View File

@ -0,0 +1,31 @@
#ifndef BOOST_PP_IS_ITERATING
/*=============================================================================
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_VECTOR40_FWD_HPP_INCLUDED)
#define BOOST_FUSION_VECTOR40_FWD_HPP_INCLUDED
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
namespace boost { namespace fusion
{
// expand vector31 to vector40
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/vector40_fwd.hpp>
#define BOOST_PP_ITERATION_LIMITS (31, 40)
#include BOOST_PP_ITERATE()
}}
#endif
#else
template <BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename T)>
struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION());
#endif

View File

@ -7,6 +7,7 @@
#if !defined(FUSION_VECTOR50_05052005_0207) #if !defined(FUSION_VECTOR50_05052005_0207)
#define FUSION_VECTOR50_05052005_0207 #define FUSION_VECTOR50_05052005_0207
#include <boost/fusion/container/vector/vector50_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/next.hpp>

View File

@ -0,0 +1,31 @@
#ifndef BOOST_PP_IS_ITERATING
/*=============================================================================
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_VECTOR50_FWD_HPP_INCLUDED)
#define BOOST_FUSION_VECTOR50_FWD_HPP_INCLUDED
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
namespace boost { namespace fusion
{
// expand vector41 to vector50
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/vector50_fwd.hpp>
#define BOOST_PP_ITERATION_LIMITS (41, 50)
#include BOOST_PP_ITERATE()
}}
#endif
#else
template <BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename T)>
struct BOOST_PP_CAT(vector, BOOST_PP_ITERATION());
#endif

View File

@ -10,6 +10,11 @@
#include <boost/fusion/container/vector/limits.hpp> #include <boost/fusion/container/vector/limits.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/fusion/container/vector/vector10_fwd.hpp>
#include <boost/fusion/container/vector/vector20_fwd.hpp>
#include <boost/fusion/container/vector/vector30_fwd.hpp>
#include <boost/fusion/container/vector/vector40_fwd.hpp>
#include <boost/fusion/container/vector/vector50_fwd.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {

View File

@ -10,6 +10,10 @@
#include <boost/fusion/sequence/intrinsic_fwd.hpp> #include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/iterator/iterator_facade.hpp> #include <boost/fusion/iterator/iterator_facade.hpp>
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/deref_data.hpp>
#include <boost/fusion/iterator/key_of.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/value_of_data.hpp>
#include <boost/fusion/iterator/detail/segmented_equal_to.hpp> #include <boost/fusion/iterator/detail/segmented_equal_to.hpp>
#include <boost/fusion/container/list/detail/reverse_cons.hpp> #include <boost/fusion/container/list/detail/reverse_cons.hpp>
@ -26,7 +30,7 @@ namespace boost { namespace fusion
// A segmented iterator wraps a "context", which is a cons list // A segmented iterator wraps a "context", which is a cons list
// of ranges, the frontmost is range over values and the rest // of ranges, the frontmost is range over values and the rest
// are ranges over internal segments. // are ranges over internal segments.
template<typename Context> template <typename Context>
struct segmented_iterator struct segmented_iterator
: iterator_facade<segmented_iterator<Context>, forward_traversal_tag> : iterator_facade<segmented_iterator<Context>, forward_traversal_tag>
{ {
@ -38,7 +42,7 @@ namespace boost { namespace fusion
//{ //{
// return deref(begin(car(it.context))) // return deref(begin(car(it.context)))
//} //}
template<typename It> template <typename It>
struct deref struct deref
{ {
typedef typedef
@ -53,9 +57,70 @@ namespace boost { namespace fusion
} }
}; };
//auto deref_data(it)
//{
// return deref_data(begin(car(it.context)))
//}
template <typename It>
struct deref_data
{
typedef
typename result_of::deref_data<
typename It::context_type::car_type::begin_type
>::type
type;
static type call(It const& it)
{
return fusion::deref_data(it.context.car.first);
}
};
//auto key_of(it)
//{
// return key_of(begin(car(it.context)))
//}
template <typename It>
struct key_of
{
typedef
typename result_of::key_of<
typename It::context_type::car_type::begin_type
>::type
type;
};
//auto value_of(it)
//{
// return value_of(begin(car(it.context)))
//}
template <typename It>
struct value_of
{
typedef
typename result_of::value_of<
typename It::context_type::car_type::begin_type
>::type
type;
};
//auto value_of_data(it)
//{
// return value_of_data(begin(car(it.context)))
//}
template <typename It>
struct value_of_data
{
typedef
typename result_of::value_of_data<
typename It::context_type::car_type::begin_type
>::type
type;
};
// Compare all the segment iterators in each stack, starting with // Compare all the segment iterators in each stack, starting with
// the bottom-most. // the bottom-most.
template<typename It1, typename It2> template <typename It1, typename It2>
struct equal_to struct equal_to
: detail::segmented_equal_to< : detail::segmented_equal_to<
typename detail::reverse_cons<typename It1::context_type>::type, typename detail::reverse_cons<typename It1::context_type>::type,
@ -63,7 +128,7 @@ namespace boost { namespace fusion
> >
{}; {};
template<typename It> template <typename It>
struct next struct next
{ {
typedef detail::segmented_next_impl<typename It::context_type> impl; typedef detail::segmented_next_impl<typename It::context_type> impl;

View File

@ -9,6 +9,11 @@
#include <boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp> #include <boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp>
#include <boost/fusion/iterator/segmented_iterator.hpp> #include <boost/fusion/iterator/segmented_iterator.hpp>
#include <boost/fusion/view/iterator_range.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/container/list/cons.hpp>
namespace boost { namespace fusion { namespace detail namespace boost { namespace fusion { namespace detail
{ {

View File

@ -35,7 +35,7 @@ namespace boost { namespace fusion { namespace detail
>::type >::type
>::type >::type
, mpl::size_t<0> , mpl::size_t<0>
, mpl::plus<mpl::_1, segmented_size<mpl::_2> > , mpl::plus<mpl::_1, segmented_size<remove_reference<mpl::_2> > >
>::type >::type
{}; {};

View File

@ -17,7 +17,6 @@
#include <boost/fusion/support/void.hpp> #include <boost/fusion/support/void.hpp>
#include <boost/fusion/container/list/cons_fwd.hpp> #include <boost/fusion/container/list/cons_fwd.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp> #include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/equal_to.hpp> #include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/next.hpp>
@ -83,9 +82,7 @@ namespace boost { namespace fusion
, typename State , typename State
, typename Context , typename Context
, typename Fun , typename Fun
, bool IsEmpty = result_of::empty< , bool IsEmpty
typename result_of::value_of<Begin>::type
>::type::value
> >
struct segmented_fold_until_iterate_skip_empty; struct segmented_fold_until_iterate_skip_empty;
@ -331,7 +328,15 @@ namespace boost { namespace fusion
struct segmented_fold_until_iterate struct segmented_fold_until_iterate
{ {
typedef typedef
segmented_fold_until_iterate_skip_empty<Begin, End, State, Context, Fun> typename result_of::empty<
typename remove_reference<
typename result_of::deref<Begin>::type
>::type
>::type
empty_type;
typedef
segmented_fold_until_iterate_skip_empty<Begin, End, State, Context, Fun, empty_type::value>
impl; impl;
typedef typename impl::type type; typedef typename impl::type type;

View File

@ -122,7 +122,7 @@ namespace boost { namespace fusion { namespace detail
> >
type; type;
static type call(Stack stack) static type call(Stack const& stack)
{ {
//return segment_sequence( //return segment_sequence(
// push_front( // push_front(
@ -168,7 +168,7 @@ namespace boost { namespace fusion { namespace detail
> >
type; type;
static type call(Stack stack) static type call(Stack const& stack)
{ {
// return iterator_range(begin(car(cdr(stack_begin))), end(front(car(stack_begin)))); // return iterator_range(begin(car(cdr(stack_begin))), end(front(car(stack_begin))));
return type(stack.cdr.car.first, fusion::end(*stack.car.first)); return type(stack.cdr.car.first, fusion::end(*stack.car.first));
@ -178,10 +178,11 @@ namespace boost { namespace fusion { namespace detail
template <typename Stack> template <typename Stack>
struct make_segment_sequence_front<Stack, 1> struct make_segment_sequence_front<Stack, 1>
{ {
typedef nil type; typedef typename Stack::cdr_type type; // nil
static type call(Stack const &)
static type call(Stack const &stack)
{ {
return nil(); return stack.cdr;
} }
}; };
@ -264,7 +265,7 @@ namespace boost { namespace fusion { namespace detail
> >
type; type;
static type call(Stack stack) static type call(Stack const& stack)
{ {
// return segment_sequence( // return segment_sequence(
// push_back( // push_back(
@ -310,7 +311,7 @@ namespace boost { namespace fusion { namespace detail
> >
type; type;
static type call(Stack stack) static type call(Stack const& stack)
{ {
// return iterator_range(begin(front(car(stack_end))), begin(car(cdr(stack_end)))); // return iterator_range(begin(front(car(stack_end))), begin(car(cdr(stack_end))));
return type(fusion::begin(*stack.car.first), stack.cdr.car.first); return type(fusion::begin(*stack.car.first), stack.cdr.car.first);
@ -320,10 +321,11 @@ namespace boost { namespace fusion { namespace detail
template <typename Stack> template <typename Stack>
struct make_segment_sequence_back<Stack, 1> struct make_segment_sequence_back<Stack, 1>
{ {
typedef nil type; typedef typename Stack::cdr_type type; // nil
static type call(Stack const &)
static type call(Stack const& stack)
{ {
return nil(); return stack.cdr;
} }
}; };
@ -490,7 +492,7 @@ namespace boost { namespace fusion { namespace detail
typedef typename impl::type type; typedef typename impl::type type;
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.context) reverse_begin_cons::call(begin.context)

View File

@ -7,6 +7,7 @@
#if !defined(FUSION_JOINT_VIEW_07162005_0140) #if !defined(FUSION_JOINT_VIEW_07162005_0140)
#define FUSION_JOINT_VIEW_07162005_0140 #define FUSION_JOINT_VIEW_07162005_0140
#include <boost/fusion/view/joint_view/joint_view_fwd.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/is_view.hpp> #include <boost/fusion/support/is_view.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>

View File

@ -0,0 +1,18 @@
/*=============================================================================
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_JOINT_VIEW_FWD_HPP_INCLUDED)
#define BOOST_FUSION_JOINT_VIEW_FWD_HPP_INCLUDED
namespace boost { namespace fusion
{
struct joint_view_tag;
template <typename Sequence1, typename Sequence2>
struct joint_view;
}}
#endif