fix support for segmented iteration

[SVN r41093]
This commit is contained in:
Eric Niebler
2007-11-14 16:36:15 +00:00
parent 5359a24800
commit d785c34d56
3 changed files with 24 additions and 11 deletions

View File

@ -117,7 +117,7 @@ namespace boost { namespace fusion { namespace detail
private:
static type call_(SegmentedRange const &range, mpl::true_)
{
return found::call(range, where::call(*range.where));
return found::call(range, where::call(*range.where_));
}
static type call_(SegmentedRange const &range, mpl::false_)

View File

@ -12,6 +12,8 @@
#include <boost/mpl/minus.hpp>
#include <boost/mpl/next_prior.hpp>
#include <boost/mpl/and.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/view/joint_view.hpp>
@ -124,26 +126,37 @@ namespace boost { namespace fusion
{}
template<typename First, typename Second>
struct result;
struct result_;
template<typename Second>
struct result<right_view, Second>
struct result_<right_view, Second>
{
typedef segmented_view<right_view, RightCons> type;
};
template<typename Second>
struct result<left_view, Second>
struct result_<left_view, Second>
{
typedef segmented_view<left_view, LeftCons> type;
};
template<typename Second>
struct result<full_view, Second>
struct result_<full_view, Second>
{
typedef Second type;
};
template<typename Sig>
struct result;
template<typename This, typename First, typename Second>
struct result<This(First, Second)>
: result_<
typename remove_cv<typename remove_reference<First>::type>::type
, typename remove_cv<typename remove_reference<Second>::type>::type
>
{};
template<typename Second>
segmented_view<right_view, RightCons> operator ()(right_view, Second &second) const
{
@ -226,7 +239,7 @@ namespace boost { namespace fusion
static type call(Sequence &seq)
{
return type(range(seq.cons.car.where, fusion::end(seq.cons.car.sequence)));
return type(range(seq.cons.car.where_, fusion::end(seq.cons.car.sequence)));
}
};
};
@ -266,7 +279,7 @@ namespace boost { namespace fusion
make_multiple_view<size_minus_1>(detail::full_view())
, make_single_view(detail::left_view())
)
, segmented_range(fusion::begin(seq.cons.car.sequence), fusion::next(seq.cons.car.where))
, segmented_range(fusion::begin(seq.cons.car.sequence), fusion::next(seq.cons.car.where_))
, tfx(seq.cons.cdr)
);
}
@ -284,7 +297,7 @@ namespace boost { namespace fusion
static type call(Sequence &seq)
{
return type(range(fusion::begin(seq.cons.car.sequence), seq.cons.car.where));
return type(range(fusion::begin(seq.cons.car.sequence), seq.cons.car.where_));
}
};
};
@ -437,7 +450,7 @@ namespace boost { namespace fusion
static type call(cons<Car1> const &cons1, cons<Car2> const &cons2)
{
return type(range(cons1.car.where, cons2.car.where));
return type(range(cons1.car.where_, cons2.car.where_));
}
};

View File

@ -43,8 +43,8 @@ process_tree(Tree const &tree)
using namespace fusion;
using mpl::_;
typedef typename result_of::find_if_s<Tree const, is_same<_,short> >::type short_iter;
typedef typename result_of::find_if_s<Tree const, is_same<_,float> >::type float_iter;
typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,short> >::type short_iter;
typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,float> >::type float_iter;
typedef iterator_range<short_iter, float_iter> slice_t;
BOOST_STATIC_ASSERT(traits::is_segmented<slice_t>::value);