creating branch for fusion 2.1

[SVN r40232]
This commit is contained in:
Joel de Guzman
2007-10-20 23:59:59 +00:00
parent c3fec7efe6
commit fc57a566cb
476 changed files with 25709 additions and 0 deletions

View File

@@ -0,0 +1,178 @@
/*=============================================================================
Copyright (c) 2001-2006 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)
==============================================================================*/
#ifndef FUSION_MULTIPLE_VIEW_05052005_0335
#define FUSION_MULTIPLE_VIEW_05052005_0335
#include <boost/mpl/int.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/next.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/support/detail/as_fusion_element.hpp>
namespace boost { namespace fusion
{
struct multiple_view_tag;
struct forward_traversal_tag;
struct fusion_sequence_tag;
template<typename Size, typename T>
struct multiple_view
: sequence_base<multiple_view<Size, T> >
{
typedef multiple_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_traversal_tag category;
typedef mpl::true_ is_view;
typedef mpl::int_<Size::value> size;
typedef T value_type;
multiple_view()
: val()
{}
explicit multiple_view(typename detail::call_param<T>::type val)
: val(val)
{}
value_type val;
};
template<typename Size, typename T>
inline multiple_view<Size, typename detail::as_fusion_element<T>::type>
make_multiple_view(T const& v)
{
return multiple_view<Size, typename detail::as_fusion_element<T>::type>(v);
}
struct multiple_view_iterator_tag;
struct forward_traversal_tag;
template<typename Index, typename MultipleView>
struct multiple_view_iterator
: iterator_base<multiple_view_iterator<Index, MultipleView> >
{
typedef multiple_view_iterator_tag fusion_tag;
typedef forward_traversal_tag category;
typedef typename MultipleView::value_type value_type;
typedef MultipleView multiple_view_type;
typedef Index index;
explicit multiple_view_iterator(multiple_view_type const &view_)
: view(view_)
{}
multiple_view_type view;
};
namespace extension
{
template <typename Tag>
struct next_impl;
template <>
struct next_impl<multiple_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef multiple_view_iterator<
typename mpl::next<typename Iterator::index>::type
, typename Iterator::multiple_view_type
> type;
static type
call(Iterator const &where)
{
return type(where.view);
}
};
};
template <typename Tag>
struct end_impl;
template <>
struct end_impl<multiple_view_tag>
{
template <typename Sequence>
struct apply
{
typedef multiple_view_iterator<
typename Sequence::size
, Sequence
> type;
static type
call(Sequence &seq)
{
return type(seq);
}
};
};
template <typename Tag>
struct deref_impl;
template <>
struct deref_impl<multiple_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::value_type type;
static type
call(Iterator const& i)
{
return i.view.val;
}
};
};
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<multiple_view_tag>
{
template <typename Sequence>
struct apply
{
typedef multiple_view_iterator<
mpl::int_<0>
, Sequence
> type;
static type
call(Sequence &seq)
{
return type(seq);
}
};
};
template <typename Tag>
struct value_of_impl;
template <>
struct value_of_impl<multiple_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::multiple_view_type multiple_view_type;
typedef typename multiple_view_type::value_type type;
};
};
}
}}
#endif

View File

@@ -0,0 +1,425 @@
/*=============================================================================
Copyright (c) 2006 Eric Niebler
Use, modification and distribution is subject to 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)
==============================================================================*/
#ifndef FUSION_SEGMENTED_ITERATOR_EAN_05032006_1027
#define FUSION_SEGMENTED_ITERATOR_EAN_05032006_1027
#include <boost/mpl/if.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/view/filter_view.hpp>
#include <boost/fusion/container/list/cons.hpp> // for nil
#include <boost/fusion/sequence/generation/make_cons.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
#include <boost/fusion/support/ext_/is_segmented.hpp>
namespace boost { namespace fusion
{
struct fusion_sequence_tag;
namespace detail
{
using mpl::_;
using mpl::not_;
////////////////////////////////////////////////////////////////////////////
template<typename Sequence>
struct is_empty
: result_of::equal_to<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type
>
{};
template<typename Sequence>
struct is_empty<Sequence &>
: is_empty<Sequence>
{};
struct segmented_range_tag;
////////////////////////////////////////////////////////////////////////////
template<typename Sequence, typename Iterator, bool IsSegmented>
struct segmented_range
: sequence_base<segmented_range<Sequence, Iterator, IsSegmented> >
{
BOOST_MPL_ASSERT_NOT((is_reference<Sequence>));
typedef mpl::bool_<IsSegmented> is_segmented;
typedef segmented_range_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef Iterator iterator_type;
// If this is a range of segments, skip over the empty ones
typedef typename mpl::if_<
is_segmented
, filter_view<Sequence, not_<is_empty<_> > >
, Sequence
>::type sequence_non_ref_type;
typedef typename mpl::if_<
traits::is_view<sequence_non_ref_type>
, sequence_non_ref_type
, sequence_non_ref_type &
>::type sequence_type;
typedef typename traits::category_of<sequence_non_ref_type>::type category;
explicit segmented_range(Sequence &sequence_)
: sequence(sequence_type(sequence_))
, where_(fusion::begin(sequence))
{}
segmented_range(sequence_type sequence_, iterator_type const &wh)
: sequence(sequence_)
, where_(wh)
{}
sequence_type sequence;
iterator_type where_;
};
}
namespace extension
{
template<>
struct is_segmented_impl<detail::segmented_range_tag>
{
template<typename Sequence>
struct apply
: Sequence::is_segmented
{};
};
template<>
struct size_impl<detail::segmented_range_tag>
{
template<typename Sequence>
struct apply
: mpl::int_<
result_of::distance<
typename Sequence::iterator_type
, typename result_of::end<typename Sequence::sequence_non_ref_type>::type
>::value
>
{};
};
template<>
struct segments_impl<detail::segmented_range_tag>
{
template<typename Sequence>
struct apply
{
typedef Sequence &type;
static type call(Sequence &seq)
{
return seq;
}
};
};
template<>
struct begin_impl<detail::segmented_range_tag>
{
template<typename Sequence>
struct apply
{
typedef typename Sequence::iterator_type type;
static type call(Sequence &seq)
{
return seq.where_;
}
};
};
template<>
struct end_impl<detail::segmented_range_tag>
{
template<typename Sequence>
struct apply
{
typedef typename Sequence::sequence_non_ref_type sequence;
typedef typename result_of::end<sequence>::type type;
static type call(Sequence &seq)
{
return fusion::end(seq.sequence);
}
};
};
}
namespace detail
{
///////////////////////////////////////////////////////////////////////
template<typename Range>
struct range_next;
template<typename Sequence, typename Iterator, bool IsSegmented>
struct range_next<segmented_range<Sequence, Iterator, IsSegmented> >
{
typedef typename result_of::next<Iterator>::type iterator_type;
typedef segmented_range<Sequence, iterator_type, IsSegmented> type;
static type call(segmented_range<Sequence, Iterator, IsSegmented> const &rng)
{
return type(rng.sequence, fusion::next(rng.where_));
}
};
///////////////////////////////////////////////////////////////////////
template<typename Cons>
struct is_range_next_empty
: is_empty<typename range_next<typename Cons::car_type>::type>
{};
template<>
struct is_range_next_empty<nil>
: mpl::true_
{};
///////////////////////////////////////////////////////////////////////
template<typename Sequence, bool IsSegmented = traits::is_segmented<Sequence>::value>
struct as_segmented_range
{
typedef typename result_of::segments<Sequence>::type segments;
typedef typename remove_reference<segments>::type sequence;
typedef typename result_of::begin<filter_view<sequence, not_<is_empty<_> > > >::type begin;
typedef segmented_range<sequence, begin, true> type;
static type call(Sequence &seq)
{
segments segs(fusion::segments(seq));
return type(segs);
}
};
template<typename Sequence>
struct as_segmented_range<Sequence, false>
{
typedef typename remove_reference<Sequence>::type sequence;
typedef typename result_of::begin<sequence>::type begin;
typedef segmented_range<sequence, begin, false> type;
static type call(Sequence &seq)
{
return type(seq);
}
};
template<typename Sequence, typename Iterator, bool IsSegmented>
struct as_segmented_range<segmented_range<Sequence, Iterator, IsSegmented>, IsSegmented>
{
typedef segmented_range<Sequence, Iterator, IsSegmented> type;
static type &call(type &seq)
{
return seq;
}
};
///////////////////////////////////////////////////////////////////////
template<
typename Sequence
, typename State = nil
, bool IsSegmented = traits::is_segmented<Sequence>::value
>
struct push_segments
{
typedef typename as_segmented_range<Sequence>::type range;
typedef typename result_of::begin<range>::type begin;
typedef typename result_of::deref<begin>::type next_ref;
typedef typename remove_reference<next_ref>::type next;
typedef push_segments<next, cons<range, State> > push;
typedef typename push::type type;
static type call(Sequence &seq, State const &state)
{
range rng(as_segmented_range<Sequence>::call(seq));
next_ref nxt(*fusion::begin(rng));
return push::call(nxt, fusion::make_cons(rng, state));
}
};
template<typename Sequence, typename State>
struct push_segments<Sequence, State, false>
{
typedef typename as_segmented_range<Sequence>::type range;
typedef cons<range, State> type;
static type call(Sequence &seq, State const &state)
{
range rng(as_segmented_range<Sequence>::call(seq));
return fusion::make_cons(rng, state);
}
};
///////////////////////////////////////////////////////////////////////
template<typename State, bool IsEmpty = is_range_next_empty<State>::value>
struct pop_segments
{
typedef range_next<typename State::car_type> next;
typedef push_segments<typename next::type, typename State::cdr_type> push;
typedef typename push::type type;
static type call(State const &state)
{
typename next::type rng(next::call(state.car));
return push::call(rng, state.cdr);
}
};
template<typename State>
struct pop_segments<State, true>
{
typedef pop_segments<typename State::cdr_type> pop;
typedef typename pop::type type;
static type call(State const &state)
{
return pop::call(state.cdr);
}
};
template<>
struct pop_segments<nil, true>
{
typedef nil type;
static type call(nil const &)
{
return nil();
}
};
} // namespace detail
struct segmented_iterator_tag;
////////////////////////////////////////////////////////////////////////////
template<typename Cons>
struct segmented_iterator
: fusion::iterator_base<segmented_iterator<Cons> >
{
typedef segmented_iterator_tag fusion_tag;
typedef fusion::forward_traversal_tag category;
typedef Cons cons_type;
typedef typename Cons::car_type car_type;
typedef typename Cons::cdr_type cdr_type;
explicit segmented_iterator(Cons const &cons)
: cons_(cons)
{}
cons_type const &cons() const { return this->cons_; };
car_type const &car() const { return this->cons_.car; };
cdr_type const &cdr() const { return this->cons_.cdr; };
private:
Cons cons_;
};
///////////////////////////////////////////////////////////////////////////
template<typename Sequence>
struct segmented_begin
{
typedef typename detail::push_segments<Sequence> push;
typedef segmented_iterator<typename push::type> type;
static type call(Sequence &seq)
{
return type(push::call(seq, nil()));
}
};
///////////////////////////////////////////////////////////////////////////
template<typename Sequence>
struct segmented_end
{
typedef segmented_iterator<nil> type;
static type call(Sequence &)
{
return type(nil());
}
};
namespace extension
{
template<>
struct value_of_impl<segmented_iterator_tag>
{
template<typename Iterator>
struct apply
{
typedef typename result_of::begin<typename Iterator::car_type>::type begin;
typedef typename result_of::value_of<begin>::type type;
};
};
template<>
struct deref_impl<segmented_iterator_tag>
{
template<typename Iterator>
struct apply
{
typedef typename result_of::begin<typename Iterator::car_type>::type begin;
typedef typename result_of::deref<begin>::type type;
static type call(Iterator const &it)
{
return *fusion::begin(it.car());
}
};
};
// discards the old head, expands the right child of the new head
// and pushes the result to the head of the list.
template<>
struct next_impl<segmented_iterator_tag>
{
template<
typename Iterator
, bool IsSegmentDone = detail::is_range_next_empty<Iterator>::value
>
struct apply
{
typedef typename Iterator::cdr_type cdr_type;
typedef detail::range_next<typename Iterator::car_type> next;
typedef segmented_iterator<cons<typename next::type, cdr_type> > type;
static type call(Iterator const &it)
{
return type(fusion::make_cons(next::call(it.car()), it.cdr()));
}
};
template<typename Iterator>
struct apply<Iterator, true> // segment done, move to next segment
{
typedef typename Iterator::cdr_type cdr_type;
typedef typename detail::pop_segments<cdr_type> pop;
typedef segmented_iterator<typename pop::type> type;
static type call(Iterator const &it)
{
return type(pop::call(it.cdr()));
}
};
};
}
}} // namespace boost::fusion
#endif

View File

@@ -0,0 +1,524 @@
/*=============================================================================
Copyright (c) 2006 Eric Niebler
Use, modification and distribution is subject to 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)
==============================================================================*/
#ifndef FUSION_SEGMENTED_ITERATOR_RANGE_EAN_05032006_1027
#define FUSION_SEGMENTED_ITERATOR_RANGE_EAN_05032006_1027
#include <boost/mpl/bool.hpp>
#include <boost/mpl/minus.hpp>
#include <boost/mpl/next_prior.hpp>
#include <boost/mpl/and.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/view/joint_view.hpp>
#include <boost/fusion/view/single_view.hpp>
#include <boost/fusion/view/transform_view.hpp>
#include <boost/fusion/view/iterator_range.hpp>
#include <boost/fusion/view/ext_/multiple_view.hpp>
#include <boost/fusion/view/ext_/segmented_iterator.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
namespace boost { namespace fusion
{
namespace detail
{
////////////////////////////////////////////////////////////////////////////
template<typename Cons, typename State = nil>
struct reverse_cons;
template<typename Car, typename Cdr, typename State>
struct reverse_cons<cons<Car, Cdr>, State>
{
typedef reverse_cons<Cdr, cons<Car, State> > reverse;
typedef typename reverse::type type;
static type call(cons<Car, Cdr> const &cons, State const &state = State())
{
return reverse::call(cons.cdr, fusion::make_cons(cons.car, state));
}
};
template<typename State>
struct reverse_cons<nil, State>
{
typedef State type;
static State const &call(nil const &, State const &state = State())
{
return state;
}
};
////////////////////////////////////////////////////////////////////////////
// tags
struct full_view {};
struct left_view {};
struct right_view {};
struct center_view {};
template<typename Tag>
struct segmented_view_tag;
////////////////////////////////////////////////////////////////////////////
// a segmented view of that includes all elements either to the
// right or the left of a segmented iterator.
template<typename Tag, typename Cons1, typename Cons2 = void_>
struct segmented_view
: sequence_base<segmented_view<Tag, Cons1, Cons2> >
{
typedef segmented_view_tag<Tag> fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef forward_traversal_tag category;
explicit segmented_view(Cons1 const &cons)
: cons(cons)
{}
typedef Cons1 cons_type;
cons_type const &cons;
};
// a segmented view that contains all the elements in between
// two segmented iterators
template<typename Cons1, typename Cons2>
struct segmented_view<center_view, Cons1, Cons2>
: sequence_base<segmented_view<center_view, Cons1, Cons2> >
{
typedef segmented_view_tag<center_view> fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef forward_traversal_tag category;
segmented_view(Cons1 const &lcons, Cons2 const &rcons)
: left_cons(lcons)
, right_cons(rcons)
{}
typedef Cons1 left_cons_type;
typedef Cons2 right_cons_type;
left_cons_type const &left_cons;
right_cons_type const &right_cons;
};
////////////////////////////////////////////////////////////////////////////
// Used to transform a sequence of segments. The first segment is
// bounded by RightCons, and the last segment is bounded by LeftCons
// and all the others are passed through unchanged.
template<typename RightCons, typename LeftCons = RightCons>
struct segments_transform
{
explicit segments_transform(RightCons const &cons_)
: right_cons(cons_)
, left_cons(cons_)
{}
segments_transform(RightCons const &right_cons_, LeftCons const &left_cons_)
: right_cons(right_cons_)
, left_cons(left_cons_)
{}
template<typename First, typename Second>
struct result;
template<typename Second>
struct result<right_view, Second>
{
typedef segmented_view<right_view, RightCons> type;
};
template<typename Second>
struct result<left_view, Second>
{
typedef segmented_view<left_view, LeftCons> type;
};
template<typename Second>
struct result<full_view, Second>
{
typedef Second type;
};
template<typename Second>
segmented_view<right_view, RightCons> operator ()(right_view, Second &second) const
{
return segmented_view<right_view, RightCons>(this->right_cons);
}
template<typename Second>
segmented_view<left_view, LeftCons> operator ()(left_view, Second &second) const
{
return segmented_view<left_view, LeftCons>(this->left_cons);
}
template<typename Second>
Second &operator ()(full_view, Second &second) const
{
return second;
}
private:
RightCons const &right_cons;
LeftCons const &left_cons;
};
} // namespace detail
namespace extension
{
////////////////////////////////////////////////////////////////////////////
template<typename Tag>
struct is_segmented_impl<detail::segmented_view_tag<Tag> >
{
template<typename Sequence>
struct apply
: mpl::true_
{};
};
////////////////////////////////////////////////////////////////////////////
template<>
struct segments_impl<detail::segmented_view_tag<detail::right_view> >
{
template<
typename Sequence
, typename Cdr = typename Sequence::cons_type::cdr_type
>
struct apply
{
typedef typename Sequence::cons_type::car_type segmented_range;
typedef typename result_of::size<segmented_range>::type size;
typedef typename mpl::prior<size>::type size_minus_1;
typedef detail::segments_transform<Cdr> tfx;
typedef joint_view<
single_view<detail::right_view> const
, multiple_view<size_minus_1, detail::full_view> const
> mask;
typedef transform_view<mask const, segmented_range const, tfx> type;
static type call(Sequence &seq)
{
return type(
mask(
make_single_view(detail::right_view())
, make_multiple_view<size_minus_1>(detail::full_view())
)
, seq.cons.car
, tfx(seq.cons.cdr)
);
}
};
template<typename Sequence>
struct apply<Sequence, nil>
{
typedef typename Sequence::cons_type::car_type segmented_range;
typedef typename segmented_range::iterator_type begin;
typedef typename segmented_range::sequence_non_ref_type sequence_type;
typedef typename result_of::end<sequence_type>::type end;
typedef iterator_range<begin, end> range;
typedef single_view<range> type;
static type call(Sequence &seq)
{
return type(range(seq.cons.car.where, fusion::end(seq.cons.car.sequence)));
}
};
};
////////////////////////////////////////////////////////////////////////////
template<>
struct segments_impl<detail::segmented_view_tag<detail::left_view> >
{
template<
typename Sequence
, typename Cdr = typename Sequence::cons_type::cdr_type
>
struct apply
{
typedef typename Sequence::cons_type::car_type right_segmented_range;
typedef typename right_segmented_range::sequence_type sequence_type;
typedef typename right_segmented_range::iterator_type iterator_type;
typedef iterator_range<
typename result_of::begin<sequence_type>::type
, typename result_of::next<iterator_type>::type
> segmented_range;
typedef detail::segments_transform<Cdr> tfx;
typedef typename result_of::size<segmented_range>::type size;
typedef typename mpl::prior<size>::type size_minus_1;
typedef joint_view<
multiple_view<size_minus_1, detail::full_view> const
, single_view<detail::left_view> const
> mask;
typedef transform_view<mask const, segmented_range const, tfx> type;
static type call(Sequence &seq)
{
return type(
mask(
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))
, tfx(seq.cons.cdr)
);
}
};
template<typename Sequence>
struct apply<Sequence, nil>
{
typedef typename Sequence::cons_type::car_type segmented_range;
typedef typename segmented_range::sequence_non_ref_type sequence_type;
typedef typename result_of::begin<sequence_type>::type begin;
typedef typename segmented_range::iterator_type end;
typedef iterator_range<begin, end> range;
typedef single_view<range> type;
static type call(Sequence &seq)
{
return type(range(fusion::begin(seq.cons.car.sequence), seq.cons.car.where));
}
};
};
////////////////////////////////////////////////////////////////////////////
template<>
struct segments_impl<detail::segmented_view_tag<detail::center_view> >
{
template<typename Sequence>
struct apply
{
typedef typename Sequence::right_cons_type right_cons_type;
typedef typename Sequence::left_cons_type left_cons_type;
typedef typename right_cons_type::car_type right_segmented_range;
typedef typename left_cons_type::car_type left_segmented_range;
typedef iterator_range<
typename result_of::begin<left_segmented_range>::type
, typename result_of::next<typename result_of::begin<right_segmented_range>::type>::type
> segmented_range;
typedef typename mpl::minus<
typename result_of::size<segmented_range>::type
, mpl::int_<2>
>::type size_minus_2;
BOOST_MPL_ASSERT_RELATION(0, <=, size_minus_2::value);
typedef detail::segments_transform<
typename left_cons_type::cdr_type
, typename right_cons_type::cdr_type
> tfx;
typedef joint_view<
multiple_view<size_minus_2, detail::full_view> const
, single_view<detail::left_view> const
> left_mask;
typedef joint_view<
single_view<detail::right_view> const
, left_mask const
> mask;
typedef transform_view<mask const, segmented_range const, tfx> type;
static type call(Sequence &seq)
{
left_mask lmask(
make_multiple_view<size_minus_2>(detail::full_view())
, make_single_view(detail::left_view())
);
return type(
mask(make_single_view(detail::right_view()), lmask)
, segmented_range(fusion::begin(seq.left_cons.car), fusion::next(fusion::begin(seq.right_cons.car)))
, tfx(seq.left_cons.cdr, seq.right_cons.cdr)
);
}
};
};
}
// specialize iterator_range for use with segmented iterators, so that
// it presents a segmented view of the range.
template<typename First, typename Last>
struct iterator_range;
template<typename First, typename Last>
struct iterator_range<segmented_iterator<First>, segmented_iterator<Last> >
: sequence_base<iterator_range<segmented_iterator<First>, segmented_iterator<Last> > >
{
typedef typename convert_iterator<segmented_iterator<First> >::type begin_type;
typedef typename convert_iterator<segmented_iterator<Last> >::type end_type;
typedef typename detail::reverse_cons<First>::type begin_cons_type;
typedef typename detail::reverse_cons<Last>::type end_cons_type;
typedef iterator_range_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef typename traits::category_of<begin_type>::type category;
typedef typename result_of::distance<begin_type, end_type>::type size;
typedef mpl::true_ is_view;
iterator_range(segmented_iterator<First> const& first_, segmented_iterator<Last> const& last_)
: first(convert_iterator<segmented_iterator<First> >::call(first_))
, last(convert_iterator<segmented_iterator<Last> >::call(last_))
, first_cons(detail::reverse_cons<First>::call(first_.cons()))
, last_cons(detail::reverse_cons<Last>::call(last_.cons()))
{}
begin_type first;
end_type last;
begin_cons_type first_cons;
end_cons_type last_cons;
};
namespace detail
{
template<typename Cons1, typename Cons2>
struct same_segment
: mpl::false_
{};
template<typename Car1, typename Cdr1, typename Car2, typename Cdr2>
struct same_segment<cons<Car1, Cdr1>, cons<Car2, Cdr2> >
: mpl::and_<
traits::is_segmented<Car1>
, is_same<Car1, Car2>
>
{};
////////////////////////////////////////////////////////////////////////////
template<typename Cons1, typename Cons2>
struct segments_gen;
////////////////////////////////////////////////////////////////////////////
template<typename Cons1, typename Cons2, bool SameSegment>
struct segments_gen2
{
typedef segments_gen<typename Cons1::cdr_type, typename Cons2::cdr_type> gen;
typedef typename gen::type type;
static type call(Cons1 const &cons1, Cons2 const &cons2)
{
return gen::call(cons1.cdr, cons2.cdr);
}
};
template<typename Cons1, typename Cons2>
struct segments_gen2<Cons1, Cons2, false>
{
typedef segmented_view<center_view, Cons1, Cons2> view;
typedef typename result_of::segments<view>::type type;
static type call(Cons1 const &cons1, Cons2 const &cons2)
{
view v(cons1, cons2);
return fusion::segments(v);
}
};
template<typename Car1, typename Car2>
struct segments_gen2<cons<Car1>, cons<Car2>, false>
{
typedef iterator_range<
typename Car1::iterator_type
, typename Car2::iterator_type
> range;
typedef single_view<range> type;
static type call(cons<Car1> const &cons1, cons<Car2> const &cons2)
{
return type(range(cons1.car.where, cons2.car.where));
}
};
////////////////////////////////////////////////////////////////////////////
template<typename Cons1, typename Cons2>
struct segments_gen
: segments_gen2<Cons1, Cons2, same_segment<Cons1, Cons2>::value>
{};
template<typename Car, typename Cdr>
struct segments_gen<cons<Car, Cdr>, nil>
{
typedef segmented_view<right_view, cons<Car, Cdr> > view;
typedef typename result_of::segments<view>::type type;
static type call(cons<Car, Cdr> const &cons, nil const &)
{
view v(cons);
return fusion::segments(v);
}
};
template<>
struct segments_gen<nil, nil>
{
typedef nil type;
static type call(nil const &, nil const &)
{
return nil();
}
};
} // namespace detail
namespace extension
{
template<typename Tag>
struct is_segmented_impl;
// An iterator_range of segmented_iterators is segmented
template<>
struct is_segmented_impl<iterator_range_tag>
{
template<typename Iterator>
struct is_segmented_iterator : mpl::false_ {};
template<typename Cons>
struct is_segmented_iterator<segmented_iterator<Cons> > : mpl::true_ {};
template<typename Sequence>
struct apply
: mpl::and_<
is_segmented_iterator<typename Sequence::begin_type>
, is_segmented_iterator<typename Sequence::end_type>
>
{};
};
template<typename Sequence>
struct segments_impl;
template<>
struct segments_impl<iterator_range_tag>
{
template<typename Sequence>
struct apply
{
typedef typename Sequence::begin_cons_type begin_cons;
typedef typename Sequence::end_cons_type end_cons;
typedef detail::segments_gen<begin_cons, end_cons> gen;
typedef typename gen::type type;
static type call(Sequence &sequence)
{
return gen::call(sequence.first_cons, sequence.last_cons);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_SEQUENCE_VIEW_FILTER_VIEW_10022005_0608)
#define FUSION_SEQUENCE_VIEW_FILTER_VIEW_10022005_0608
#include <boost/fusion/view/filter_view/filter_view.hpp>
#include <boost/fusion/view/filter_view/filter_view_iterator.hpp>
#endif

View File

@@ -0,0 +1,45 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_BEGIN_IMPL_05062005_0903)
#define FUSION_BEGIN_IMPL_05062005_0903
namespace boost { namespace fusion
{
struct filter_view_tag;
template <typename First, typename Last, typename Pred>
struct filter_iterator;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<filter_view_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::first_type first_type;
typedef typename Sequence::last_type last_type;
typedef typename Sequence::pred_type pred_type;
typedef filter_iterator<first_type, last_type, pred_type> type;
static type
call(Sequence& s)
{
return type(s.first());
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,29 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_DEREF_IMPL_05062005_0905)
#define FUSION_DEREF_IMPL_05062005_0905
#include <boost/fusion/iterator/detail/adapt_deref_traits.hpp>
namespace boost { namespace fusion
{
struct filter_view_iterator_tag;
namespace extension
{
template <typename Tag>
struct deref_impl;
template <>
struct deref_impl<filter_view_iterator_tag>
: detail::adapt_deref_traits {};
}
}}
#endif

View File

@@ -0,0 +1,44 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_END_IMPL_05062005_0906)
#define FUSION_END_IMPL_05062005_0906
namespace boost { namespace fusion
{
struct filter_view_tag;
template <typename First, typename Last, typename Pred>
struct filter_iterator;
namespace extension
{
template <typename Tag>
struct end_impl;
template <>
struct end_impl<filter_view_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::last_type last_type;
typedef typename Sequence::pred_type pred_type;
typedef filter_iterator<last_type, last_type, pred_type> type;
static type
call(Sequence& s)
{
return type(s.last());
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,34 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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_EQUAL_TO_IMPL_02012005_2133)
#define BOOST_FUSION_EQUAL_TO_IMPL_02012005_2133
namespace boost { namespace fusion
{
struct filter_view_iterator_tag;
namespace extension
{
template<typename I1, typename I2>
struct equal_to;
template<typename Tag>
struct equal_to_impl;
template<>
struct equal_to_impl<filter_view_iterator_tag>
{
template<typename I1, typename I2>
struct apply
: result_of::equal_to<typename I1::first_type, typename I2::first_type>
{};
};
}
}}
#endif

View File

@@ -0,0 +1,64 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_NEXT_IMPL_06052005_0900)
#define FUSION_NEXT_IMPL_06052005_0900
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
namespace boost { namespace fusion
{
struct filter_view_iterator_tag;
template <typename First, typename Last, typename Pred>
struct filter_iterator;
namespace extension
{
template <typename Tag>
struct next_impl;
template <>
struct next_impl<filter_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::first_type first_type;
typedef typename Iterator::last_type last_type;
typedef typename Iterator::pred_type pred_type;
typedef typename
mpl::eval_if<
result_of::equal_to<first_type, last_type>
, mpl::identity<last_type>
, result_of::next<first_type>
>::type
next_type;
typedef typename detail::static_find_if<
next_type, last_type, pred_type>
filter;
typedef filter_iterator<
typename filter::type, last_type, pred_type>
type;
static type
call(Iterator const& i)
{
return type(filter::call(i.first));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,38 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_SIZE_IMPL_09232005_1058)
#define FUSION_SIZE_IMPL_09232005_1058
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
namespace boost { namespace fusion
{
struct filter_view_tag;
namespace extension
{
template <typename Tag>
struct size_impl;
template <>
struct size_impl<filter_view_tag>
{
template <typename Sequence>
struct apply
: result_of::distance<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type>
{};
};
}
}}
#endif

View File

@@ -0,0 +1,29 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_VALUE_OF_IMPL_05062005_0857)
#define FUSION_VALUE_OF_IMPL_05062005_0857
#include <boost/fusion/iterator/detail/adapt_value_traits.hpp>
namespace boost { namespace fusion
{
struct filter_view_iterator_tag;
namespace extension
{
template <typename Tag>
struct value_of_impl;
template <>
struct value_of_impl<filter_view_iterator_tag>
: detail::adapt_value_traits {};
}
}}
#endif

View File

@@ -0,0 +1,51 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_SEQUENCE_FILTER_VIEW_HPP)
#define FUSION_SEQUENCE_FILTER_VIEW_HPP
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/is_view.hpp>
#include <boost/fusion/view/filter_view/filter_view_iterator.hpp>
#include <boost/fusion/view/filter_view/detail/begin_impl.hpp>
#include <boost/fusion/view/filter_view/detail/end_impl.hpp>
#include <boost/fusion/view/filter_view/detail/size_impl.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct filter_view_tag;
struct forward_traversal_tag;
struct fusion_sequence_tag;
template <typename Sequence, typename Pred>
struct filter_view : sequence_base<filter_view<Sequence, Pred> >
{
typedef filter_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_traversal_tag category;
typedef mpl::true_ is_view;
typedef typename result_of::begin<Sequence>::type first_type;
typedef typename result_of::end<Sequence>::type last_type;
typedef Pred pred_type;
filter_view(Sequence& seq)
: seq(seq)
{}
first_type first() const { return fusion::begin(seq); }
last_type last() const { return fusion::end(seq); }
typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq;
};
}}
#endif

View File

@@ -0,0 +1,48 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_FILTER_VIEW_ITERATOR_05062005_0849)
#define FUSION_FILTER_VIEW_ITERATOR_05062005_0849
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/view/filter_view/detail/deref_impl.hpp>
#include <boost/fusion/view/filter_view/detail/next_impl.hpp>
#include <boost/fusion/view/filter_view/detail/value_of_impl.hpp>
#include <boost/fusion/view/filter_view/detail/equal_to_impl.hpp>
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
namespace boost { namespace fusion
{
struct filter_view_iterator_tag;
struct forward_traversal_tag;
template <typename First, typename Last, typename Pred>
struct filter_iterator : iterator_base<filter_iterator<First, Last, Pred> >
{
typedef convert_iterator<First> first_converter;
typedef typename first_converter::type first_iter;
typedef convert_iterator<Last> last_converter;
typedef typename last_converter::type last_iter;
typedef filter_view_iterator_tag fusion_tag;
typedef forward_traversal_tag category;
typedef detail::static_find_if<first_iter, last_iter, Pred> filter;
typedef typename filter::type first_type;
typedef last_iter last_type;
typedef Pred pred_type;
filter_iterator(First const& first)
: first(filter::call(first_converter::call(first))) {}
first_type first;
};
}}
#endif

View File

@@ -0,0 +1,12 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_SEQUENCE_VIEW_ITERATOR_RANGE_10022005_0610)
#define FUSION_SEQUENCE_VIEW_ITERATOR_RANGE_10022005_0610
#include <boost/fusion/view/iterator_range/iterator_range.hpp>
#endif

View File

@@ -0,0 +1,44 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_ITERATOR_RANGE_AT_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_ITERATOR_RANGE_AT_IMPL_HPP_INCLUDED
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/iterator/deref.hpp>
namespace boost { namespace fusion
{
struct iterator_range_tag;
namespace extension
{
template <typename Tag>
struct at_impl;
template <>
struct at_impl<iterator_range_tag>
{
template <typename Seq, typename N>
struct apply
{
typedef typename Seq::begin_type begin_type;
typedef typename result_of::advance<begin_type,N>::type pos;
typedef typename result_of::deref<pos>::type type;
static type
call(Seq& s)
{
return * advance<N>(s.first);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,39 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_BEGIN_IMPL_05062005_1226)
#define FUSION_BEGIN_IMPL_05062005_1226
namespace boost { namespace fusion
{
struct iterator_range_tag;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<iterator_range_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::begin_type type;
static type
call(Sequence& s)
{
return s.first;
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,39 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_END_IMPL_05062005_1226)
#define FUSION_END_IMPL_05062005_1226
namespace boost { namespace fusion
{
struct iterator_range_tag;
namespace extension
{
template <typename Tag>
struct end_impl;
template <>
struct end_impl<iterator_range_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::end_type type;
static type
call(Sequence& s)
{
return s.last;
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,38 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_ITERATOR_RANGE_VALUE_AT_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_ITERATOR_RANGE_VALUE_AT_IMPL_HPP_INCLUDED
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/iterator/value_of.hpp>
namespace boost { namespace fusion
{
struct iterator_range_tag;
namespace extension
{
template <typename Tag>
struct value_at_impl;
template <>
struct value_at_impl<iterator_range_tag>
{
template <typename Seq, typename N>
struct apply
{
typedef typename Seq::begin_type begin_type;
typedef typename result_of::advance<begin_type,N>::type pos;
typedef typename result_of::value_of<pos>::type type;
};
};
}
}}
#endif

View File

@@ -0,0 +1,50 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_ITERATOR_RANGE_05062005_1224)
#define FUSION_ITERATOR_RANGE_05062005_1224
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/view/iterator_range/detail/begin_impl.hpp>
#include <boost/fusion/view/iterator_range/detail/end_impl.hpp>
#include <boost/fusion/view/iterator_range/detail/at_impl.hpp>
#include <boost/fusion/view/iterator_range/detail/value_at_impl.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct iterator_range_tag;
struct fusion_sequence_tag;
template <typename First, typename Last>
struct iterator_range : sequence_base<iterator_range<First, Last> >
{
typedef typename convert_iterator<First>::type begin_type;
typedef typename convert_iterator<Last>::type end_type;
typedef iterator_range_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef typename result_of::distance<begin_type, end_type>::type size;
typedef mpl::true_ is_view;
typedef typename traits::category_of<begin_type>::type category;
iterator_range(First const& first, Last const& last)
: first(convert_iterator<First>::call(first))
, last(convert_iterator<Last>::call(last)) {}
begin_type first;
end_type last;
};
}}
#endif

View File

@@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_SEQUENCE_VIEW_JOINT_VIEW_10022005_0610)
#define FUSION_SEQUENCE_VIEW_JOINT_VIEW_10022005_0610
#include <boost/fusion/view/joint_view/joint_view.hpp>
#include <boost/fusion/view/joint_view/joint_view_iterator.hpp>
#endif

View File

@@ -0,0 +1,66 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_BEGIN_IMPL_07162005_0115)
#define FUSION_BEGIN_IMPL_07162005_0115
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace fusion
{
struct joint_view_tag;
template <typename First, typename Last, typename Concat>
struct joint_view_iterator;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<joint_view_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::first_type first_type;
typedef typename Sequence::last_type last_type;
typedef typename Sequence::concat_type concat_type;
typedef result_of::equal_to<first_type, last_type> equal_to;
typedef typename
mpl::if_<
equal_to
, concat_type
, joint_view_iterator<first_type, last_type, concat_type>
>::type
type;
static type
call(Sequence& s, mpl::true_)
{
return s.concat();
}
static type
call(Sequence& s, mpl::false_)
{
return type(s.first(), s.concat());
}
static type
call(Sequence& s)
{
return call(s, equal_to());
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,29 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_DEREF_IMPL_07162005_0137)
#define FUSION_DEREF_IMPL_07162005_0137
#include <boost/fusion/iterator/detail/adapt_deref_traits.hpp>
namespace boost { namespace fusion
{
struct joint_view_iterator_tag;
namespace extension
{
template <typename Tag>
struct deref_impl;
template <>
struct deref_impl<joint_view_iterator_tag>
: detail::adapt_deref_traits {};
}
}}
#endif

View File

@@ -0,0 +1,40 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_END_IMPL_07162005_0128)
#define FUSION_END_IMPL_07162005_0128
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace fusion
{
struct joint_view_tag;
namespace extension
{
template <typename Tag>
struct end_impl;
template <>
struct end_impl<joint_view_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::concat_last_type type;
static type
call(Sequence& s)
{
return s.concat_last();
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,70 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_NEXT_IMPL_07162005_0136)
#define FUSION_NEXT_IMPL_07162005_0136
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace fusion
{
struct joint_view_iterator_tag;
template <typename First, typename Last, typename Concat>
struct joint_view_iterator;
namespace extension
{
template <typename Tag>
struct next_impl;
template <>
struct next_impl<joint_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::first_type first_type;
typedef typename Iterator::last_type last_type;
typedef typename Iterator::concat_type concat_type;
typedef typename result_of::next<first_type>::type next_type;
typedef result_of::equal_to<next_type, last_type> equal_to;
typedef typename
mpl::if_<
equal_to
, concat_type
, joint_view_iterator<next_type, last_type, concat_type>
>::type
type;
static type
call(Iterator const& i, mpl::true_)
{
return i.concat;
}
static type
call(Iterator const& i, mpl::false_)
{
return type(fusion::next(i.first), i.concat);
}
static type
call(Iterator const& i)
{
return call(i, equal_to());
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,29 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_VALUE_IMPL_07162005_0132)
#define FUSION_VALUE_IMPL_07162005_0132
#include <boost/fusion/iterator/detail/adapt_value_traits.hpp>
namespace boost { namespace fusion
{
struct joint_view_iterator_tag;
namespace extension
{
template <typename Tag>
struct value_of_impl;
template <>
struct value_of_impl<joint_view_iterator_tag>
: detail::adapt_value_traits {};
}
}}
#endif

View File

@@ -0,0 +1,61 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_JOINT_VIEW_07162005_0140)
#define FUSION_JOINT_VIEW_07162005_0140
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/is_view.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/view/joint_view/joint_view_iterator.hpp>
#include <boost/fusion/view/joint_view/detail/begin_impl.hpp>
#include <boost/fusion/view/joint_view/detail/end_impl.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct joint_view_tag;
struct forward_traversal_tag;
struct fusion_sequence_tag;
template <typename Sequence1, typename Sequence2>
struct joint_view : sequence_base<joint_view<Sequence1, Sequence2> >
{
typedef joint_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_traversal_tag category;
typedef mpl::true_ is_view;
typedef typename result_of::begin<Sequence1>::type first_type;
typedef typename result_of::end<Sequence1>::type last_type;
typedef typename result_of::begin<Sequence2>::type concat_type;
typedef typename result_of::end<Sequence2>::type concat_last_type;
typedef typename mpl::plus<result_of::size<Sequence1>, result_of::size<Sequence2> >::type size;
joint_view(Sequence1& seq1, Sequence2& seq2)
: seq1(seq1)
, seq2(seq2)
{}
first_type first() const { return fusion::begin(seq1); }
concat_type concat() const { return fusion::begin(seq2); }
concat_last_type concat_last() const { return fusion::end(seq2); }
private:
typename mpl::if_<traits::is_view<Sequence1>, Sequence1, Sequence1&>::type seq1;
typename mpl::if_<traits::is_view<Sequence2>, Sequence2, Sequence2&>::type seq2;
};
}}
#endif

View File

@@ -0,0 +1,52 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_JOINT_VIEW_ITERATOR_07162005_0140)
#define FUSION_JOINT_VIEW_ITERATOR_07162005_0140
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/fusion/view/joint_view/detail/deref_impl.hpp>
#include <boost/fusion/view/joint_view/detail/next_impl.hpp>
#include <boost/fusion/view/joint_view/detail/value_of_impl.hpp>
#include <boost/static_assert.hpp>
namespace boost { namespace fusion
{
struct joint_view_iterator_tag;
struct forward_traversal_tag;
template <typename First, typename Last, typename Concat>
struct joint_view_iterator
: iterator_base<joint_view_iterator<First, Last, Concat> >
{
typedef convert_iterator<First> first_converter;
typedef convert_iterator<Last> last_converter;
typedef convert_iterator<Concat> concat_converter;
typedef typename first_converter::type first_type;
typedef typename last_converter::type last_type;
typedef typename concat_converter::type concat_type;
typedef joint_view_iterator_tag fusion_tag;
typedef forward_traversal_tag category;
BOOST_STATIC_ASSERT((!result_of::equal_to<first_type, last_type>::value));
joint_view_iterator(First const& first, Concat const& concat)
: first(first_converter::call(first))
, concat(concat_converter::call(concat))
{}
first_type first;
concat_type concat;
};
}}
#endif

View File

@@ -0,0 +1,15 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_REPETITIVE_VIEW_HPP_INCLUDED)
#define BOOST_FUSION_REPETITIVE_VIEW_HPP_INCLUDED
#include <boost/fusion/view/repetitive_view/repetitive_view.hpp>
#include <boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp>
#endif

View File

@@ -0,0 +1,49 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_REPETITIVE_VIEW_BEGIN_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_REPETITIVE_VIEW_BEGIN_IMPL_HPP_INCLUDED
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/view/repetitive_view/repetitive_view_fwd.hpp>
namespace boost { namespace fusion
{
struct repetitive_view_tag;
template <typename Sequence, typename Pos>
struct repetitive_view_iterator;
namespace extension
{
template<typename Tag>
struct begin_impl;
template<>
struct begin_impl<repetitive_view_tag>
{
template<typename View>
struct apply
{
typedef typename View::sequence_type sequence_type;
typedef repetitive_view_iterator<sequence_type,
typename result_of::begin<sequence_type>::type > type;
static type call(View const& v)
{
return type(v.seq);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,44 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_REPETITIVE_VIEW_DEREF_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_REPETITIVE_VIEW_DEREF_IMPL_HPP_INCLUDED
#include <boost/fusion/iterator/deref.hpp>
namespace boost { namespace fusion
{
struct repetitive_view_iterator_tag;
namespace extension
{
template<typename Tag>
struct deref_impl;
template<>
struct deref_impl<repetitive_view_iterator_tag>
{
template<typename Iterator>
struct apply
{
typedef typename
result_of::deref<typename Iterator::pos_type>::type
type;
static type call(Iterator const& i)
{
return *i.pos;
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,49 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_REPETITIVE_VIEW_END_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_REPETITIVE_VIEW_END_IMPL_HPP_INCLUDED
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/view/repetitive_view/repetitive_view_fwd.hpp>
namespace boost { namespace fusion
{
struct repetitive_view_tag;
template <typename Sequence, typename Pos>
struct repetitive_view_iterator;
namespace extension
{
template<typename Tag>
struct end_impl;
template<>
struct end_impl<repetitive_view_tag>
{
template<typename View>
struct apply
{
typedef typename View::sequence_type sequence_type;
typedef repetitive_view_iterator<sequence_type,
typename result_of::end<sequence_type>::type > type;
static type call(View const& v)
{
return type(v.seq,end(v.seq));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,90 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_REPETITIVE_VIEW_NEXT_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_REPETITIVE_VIEW_NEXT_IMPL_HPP_INCLUDED
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
namespace boost { namespace fusion
{
struct repetitive_view_iterator_tag;
template <typename Sequence, typename Pos>
struct repetitive_view_iterator;
namespace extension
{
template <typename Tag>
struct next_impl;
template <>
struct next_impl<repetitive_view_iterator_tag>
{
template<typename Iterator,
bool Last = result_of::equal_to<typename Iterator::end_type,
typename result_of::next<
typename Iterator::pos_type
>::type>::value >
struct apply_nonempty // <Iterator,false>
{
// advanvce to next position
typedef repetitive_view_iterator<
typename Iterator::sequence_type,
typename result_of::next<typename Iterator::pos_type>::type
>
type;
static type call(Iterator const& i)
{
return type(i.seq, next(i.pos));
}
};
template <typename Iterator>
struct apply_nonempty<Iterator,true>
{
// reset to beginning
typedef repetitive_view_iterator<
typename Iterator::sequence_type,
typename Iterator::first_type
>
type;
static type call(Iterator const& i)
{
return type(i.seq);
}
};
template <typename Iterator,
bool Empty = result_of::equal_to<typename Iterator::end_type,
typename Iterator::pos_type>::value >
struct apply // <Iterator,false>
: apply_nonempty<Iterator>
{ };
template <typename Iterator>
struct apply<Iterator,true>
{
// eps^n = eps
typedef Iterator type;
static type call(Iterator const& i)
{
return type(i);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,34 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_REPETITIVE_VIEW_VALUE_OF_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_REPETITIVE_VIEW_VALUE_OF_IMPL_HPP_INCLUDED
#include <boost/fusion/iterator/value_of.hpp>
namespace boost { namespace fusion
{
struct repetitive_view_iterator_tag;
namespace extension
{
template<typename Tag>
struct value_of_impl;
template<>
struct value_of_impl<repetitive_view_iterator_tag>
{
template<typename Iterator>
struct apply
: result_of::value_of<typename Iterator::pos_type>
{ };
};
}
}}
#endif

View File

@@ -0,0 +1,48 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_REPETITIVE_REPETITIVE_VIEW_VIEW_HPP_INCLUDED)
#define BOOST_FUSION_REPETITIVE_VIEW_REPETITIVE_VIEW_HPP_INCLUDED
#include <boost/type_traits/remove_reference.hpp>
#include <boost/mpl/if.hpp>
#include <boost/fusion/support/is_view.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/view/repetitive_view/detail/begin_impl.hpp>
#include <boost/fusion/view/repetitive_view/detail/end_impl.hpp>
namespace boost { namespace fusion
{
struct repetitive_view_tag;
struct fusion_sequence_tag;
template<typename Sequence> struct repetitive_view
: sequence_base< repetitive_view<Sequence> >
{
typedef repetitive_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef single_pass_traversal_tag category;
typedef typename boost::remove_reference<Sequence>::type sequence_type;
typedef typename
mpl::if_<traits::is_view<Sequence>, Sequence, sequence_type&>::type
stored_seq_type;
repetitive_view(Sequence& seq)
: seq(seq) {}
stored_seq_type seq;
};
}}
#endif

View File

@@ -0,0 +1,19 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_REPETITIVE_VIEW_FWD_HPP_INCLUDED)
#define BOOST_FUSION_REPETITIVE_VIEW_FWD_HPP_INCLUDED
namespace boost { namespace fusion
{
struct repetitive_view_tag;
template<typename Sequence> struct repetitive_view;
}}
#endif

View File

@@ -0,0 +1,51 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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_REPETITIVE_VIEW_ITERATOR_HPP_INCLUDED)
#define BOOST_FUSION_REPETITIVE_VIEW_HPP_ITERATOR_INCLUDED
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/view/repetitive_view/detail/deref_impl.hpp>
#include <boost/fusion/view/repetitive_view/detail/next_impl.hpp>
#include <boost/fusion/view/repetitive_view/detail/value_of_impl.hpp>
namespace boost { namespace fusion
{
struct repetitive_view_iterator_tag;
template<typename Sequence, typename Pos =
typename result_of::begin<Sequence>::type>
struct repetitive_view_iterator
: iterator_base< repetitive_view_iterator<Sequence,Pos> >
{
typedef repetitive_view_iterator_tag fusion_tag;
typedef Sequence sequence_type;
typedef typename convert_iterator<Pos>::type pos_type;
typedef typename convert_iterator<typename result_of::begin<Sequence>::type>::type first_type;
typedef typename convert_iterator<typename result_of::end<Sequence>::type>::type end_type;
typedef single_pass_traversal_tag category;
explicit repetitive_view_iterator(Sequence& seq)
: seq(seq), pos(begin(seq)) {}
repetitive_view_iterator(Sequence& seq, pos_type const& pos)
: seq(seq), pos(pos) {}
Sequence& seq;
pos_type pos;
};
}}
#endif

View File

@@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_SEQUENCE_VIEW_REVERSE_VIEW_10022005_0612)
#define FUSION_SEQUENCE_VIEW_REVERSE_VIEW_10022005_0612
#include <boost/fusion/view/reverse_view/reverse_view.hpp>
#include <boost/fusion/view/reverse_view/reverse_view_iterator.hpp>
#endif

View File

@@ -0,0 +1,47 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(FUSION_ADVANCE_IMPL_14122005_2015)
#define FUSION_ADVANCE_IMPL_14122005_2015
#include <boost/fusion/iterator/advance.hpp>
#include <boost/mpl/negate.hpp>
namespace boost { namespace fusion {
struct reverse_view_iterator_tag;
template <typename Iterator>
struct reverse_view_iterator;
namespace extension
{
template<typename Tag>
struct advance_impl;
template<>
struct advance_impl<reverse_view_iterator_tag>
{
template<typename Iterator, typename Dist>
struct apply
{
typedef typename Iterator::first_type first_type;
typedef typename mpl::negate<Dist>::type negative_dist;
typedef typename result_of::advance<first_type, negative_dist>::type advanced_type;
typedef reverse_view_iterator<advanced_type> type;
static type
call(Iterator const& i)
{
return type(boost::fusion::advance<negative_dist>(i.first));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,42 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_BEGIN_IMPL_07202005_0849)
#define FUSION_BEGIN_IMPL_07202005_0849
namespace boost { namespace fusion
{
struct reverse_view_tag;
template <typename Iterator>
struct reverse_view_iterator;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<reverse_view_tag>
{
template <typename Sequence>
struct apply
{
typedef reverse_view_iterator<typename Sequence::last_type> type;
static type
call(Sequence const& s)
{
return type(s.last());
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,48 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_DEREF_IMPL_07202005_0851)
#define FUSION_DEREF_IMPL_07202005_0851
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/prior.hpp>
namespace boost { namespace fusion
{
struct reverse_view_iterator_tag;
namespace extension
{
template <typename Tag>
struct deref_impl;
template <>
struct deref_impl<reverse_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename
result_of::deref<
typename result_of::prior<
typename Iterator::first_type
>::type
>::type
type;
static type
call(Iterator const& i)
{
return *fusion::prior(i.first);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,45 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(FUSION_DISTANCE_IMPL_14122005_2104)
#define FUSION_DISTANCE_IMPL_14122005_2104
#include <boost/fusion/iterator/distance.hpp>
namespace boost { namespace fusion {
struct reverse_view_iterator_tag;
template <typename Iterator>
struct reverse_view_iterator;
namespace extension
{
template<typename Tag>
struct distance_impl;
template<>
struct distance_impl<reverse_view_iterator_tag>
{
template<typename First, typename Last>
struct apply
{
typedef typename First::first_type first_type;
typedef typename Last::first_type last_type;
typedef typename result_of::distance<last_type, first_type>::type type;
static type
call(First const& first, Last const& last)
{
return boost::fusion::distance(last.first, first.first);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,42 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_END_IMPL_07202005_0851)
#define FUSION_END_IMPL_07202005_0851
namespace boost { namespace fusion
{
struct reverse_view_tag;
template <typename Iterator>
struct reverse_view_iterator;
namespace extension
{
template <typename Tag>
struct end_impl;
template <>
struct end_impl<reverse_view_tag>
{
template <typename Sequence>
struct apply
{
typedef reverse_view_iterator<typename Sequence::first_type> type;
static type
call(Sequence const& s)
{
return type(s.first());
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,47 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_NEXT_IMPL_07202005_0856)
#define FUSION_NEXT_IMPL_07202005_0856
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/prior.hpp>
namespace boost { namespace fusion
{
struct reverse_view_iterator_tag;
template <typename Iterator>
struct reverse_view_iterator;
namespace extension
{
template <>
struct next_impl<reverse_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::first_type first_type;
typedef typename prior_impl<typename first_type::fusion_tag>::
template apply<first_type>
wrapped;
typedef reverse_view_iterator<typename wrapped::type> type;
static type
call(Iterator const& i)
{
return type(wrapped::call(i.first));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,47 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_PRIOR_IMPL_07202005_0857)
#define FUSION_PRIOR_IMPL_07202005_0857
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/prior.hpp>
namespace boost { namespace fusion
{
struct reverse_view_iterator_tag;
template <typename Iterator>
struct reverse_view_iterator;
namespace extension
{
template <>
struct prior_impl<reverse_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::first_type first_type;
typedef typename next_impl<typename first_type::fusion_tag>::
template apply<first_type>
wrapped;
typedef reverse_view_iterator<typename wrapped::type> type;
static type
call(Iterator const& i)
{
return type(wrapped::call(i.first));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,42 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_VALUE_OF_IMPL_07202005_0900)
#define FUSION_VALUE_OF_IMPL_07202005_0900
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/prior.hpp>
namespace boost { namespace fusion
{
struct reverse_view_iterator_tag;
namespace extension
{
template <typename Tag>
struct value_of_impl;
template <>
struct value_of_impl<reverse_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename
result_of::value_of<
typename result_of::prior<
typename Iterator::first_type
>::type
>::type
type;
};
};
}
}}
#endif

View File

@@ -0,0 +1,58 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_REVERSE_VIEW_07202005_0836)
#define FUSION_REVERSE_VIEW_07202005_0836
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/is_view.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/view/reverse_view/reverse_view_iterator.hpp>
#include <boost/fusion/view/reverse_view/detail/begin_impl.hpp>
#include <boost/fusion/view/reverse_view/detail/end_impl.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/static_assert.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct reverse_view_tag;
struct fusion_sequence_tag;
template <typename Sequence>
struct reverse_view : sequence_base<reverse_view<Sequence> >
{
typedef reverse_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef typename traits::category_of<Sequence>::type category;
typedef typename result_of::begin<Sequence>::type first_type;
typedef typename result_of::end<Sequence>::type last_type;
typedef typename result_of::size<Sequence>::type size;
BOOST_STATIC_ASSERT((
is_base_of<
bidirectional_traversal_tag
, typename traits::category_of<first_type>::type>::value));
reverse_view(Sequence& seq)
: seq(seq)
{}
first_type first() const { return fusion::begin(seq); }
last_type last() const { return fusion::end(seq); }
typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq;
};
}}
#endif

View File

@@ -0,0 +1,49 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_REVERSE_VIEW_ITERATOR_07202005_0835)
#define FUSION_REVERSE_VIEW_ITERATOR_07202005_0835
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/fusion/view/reverse_view/detail/deref_impl.hpp>
#include <boost/fusion/view/reverse_view/detail/next_impl.hpp>
#include <boost/fusion/view/reverse_view/detail/prior_impl.hpp>
#include <boost/fusion/view/reverse_view/detail/advance_impl.hpp>
#include <boost/fusion/view/reverse_view/detail/distance_impl.hpp>
#include <boost/fusion/view/reverse_view/detail/value_of_impl.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/static_assert.hpp>
namespace boost { namespace fusion
{
struct reverse_view_iterator_tag;
template <typename First>
struct reverse_view_iterator
: iterator_base<reverse_view_iterator<First> >
{
typedef convert_iterator<First> converter;
typedef typename converter::type first_type;
typedef reverse_view_iterator_tag fusion_tag;
typedef typename traits::category_of<first_type>::type category;
BOOST_STATIC_ASSERT((
is_base_of<
bidirectional_traversal_tag
, category>::value));
reverse_view_iterator(First const& first)
: first(converter::call(first)) {}
first_type first;
};
}}
#endif

View File

@@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_SINGLE_VIEW_03192006_2216)
#define FUSION_SINGLE_VIEW_03192006_2216
#include <boost/fusion/view/single_view/single_view.hpp>
#include <boost/fusion/view/single_view/single_view_iterator.hpp>
#endif

View File

@@ -0,0 +1,42 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_BEGIN_IMPL_05052005_0305)
#define FUSION_BEGIN_IMPL_05052005_0305
namespace boost { namespace fusion
{
struct single_view_tag;
template <typename T>
struct single_view_iterator;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<single_view_tag>
{
template <typename Sequence>
struct apply
{
typedef single_view_iterator<Sequence> type;
static type
call(Sequence& s)
{
return type(s);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,43 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_DEREF_IMPL_05052005_0258)
#define FUSION_DEREF_IMPL_05052005_0258
#include <boost/fusion/support/detail/access.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace fusion
{
struct single_view_iterator_tag;
namespace extension
{
template <typename Tag>
struct deref_impl;
template <>
struct deref_impl<single_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::value_type type;
static type
call(Iterator const& i)
{
return i.val;
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,42 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_END_IMPL_05052005_0332)
#define FUSION_END_IMPL_05052005_0332
namespace boost { namespace fusion
{
struct single_view_tag;
template <typename T>
struct single_view_iterator_end;
namespace extension
{
template <typename Tag>
struct end_impl;
template <>
struct end_impl<single_view_tag>
{
template <typename Sequence>
struct apply
{
typedef single_view_iterator_end<Sequence> type;
static type
call(Sequence&)
{
return type();
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,47 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_NEXT_IMPL_05052005_0331)
#define FUSION_NEXT_IMPL_05052005_0331
namespace boost { namespace fusion
{
struct single_view_iterator_tag;
template <typename SingleView>
struct single_view_iterator_end;
template <typename SingleView>
struct single_view_iterator;
namespace extension
{
template <typename Tag>
struct next_impl;
template <>
struct next_impl<single_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef single_view_iterator_end<
typename Iterator::single_view_type>
type;
static type
call(Iterator)
{
return type();
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,34 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_VALUE_IMPL_05052005_0324)
#define FUSION_VALUE_IMPL_05052005_0324
namespace boost { namespace fusion
{
struct single_view_iterator_tag;
namespace extension
{
template <typename Tag>
struct value_of_impl;
template <>
struct value_of_impl<single_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::single_view_type single_view_type;
typedef typename single_view_type::value_type type;
};
};
}
}}
#endif

View File

@@ -0,0 +1,54 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_SINGLE_VIEW_05052005_0335)
#define FUSION_SINGLE_VIEW_05052005_0335
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/view/single_view/single_view_iterator.hpp>
#include <boost/fusion/view/single_view/detail/begin_impl.hpp>
#include <boost/fusion/view/single_view/detail/end_impl.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/int.hpp>
namespace boost { namespace fusion
{
struct single_view_tag;
struct forward_traversal_tag;
struct fusion_sequence_tag;
template <typename T>
struct single_view : sequence_base<single_view<T> >
{
typedef single_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef forward_traversal_tag category;
typedef mpl::true_ is_view;
typedef mpl::int_<1> size;
typedef T value_type;
single_view()
: val() {}
explicit single_view(typename detail::call_param<T>::type val)
: val(val) {}
value_type val;
};
template <typename T>
inline single_view<typename detail::as_fusion_element<T>::type>
make_single_view(T const& v)
{
return single_view<typename detail::as_fusion_element<T>::type>(v);
}
}}
#endif

View File

@@ -0,0 +1,47 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_SINGLE_VIEW_ITERATOR_05052005_0340)
#define FUSION_SINGLE_VIEW_ITERATOR_05052005_0340
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/view/single_view/detail/deref_impl.hpp>
#include <boost/fusion/view/single_view/detail/next_impl.hpp>
#include <boost/fusion/view/single_view/detail/value_of_impl.hpp>
namespace boost { namespace fusion
{
struct single_view_iterator_tag;
struct forward_traversal_tag;
template <typename SingleView>
struct single_view_iterator_end
: iterator_base<single_view_iterator_end<SingleView> >
{
typedef single_view_iterator_tag fusion_tag;
typedef forward_traversal_tag category;
};
template <typename SingleView>
struct single_view_iterator
: iterator_base<single_view_iterator<SingleView> >
{
typedef single_view_iterator_tag fusion_tag;
typedef forward_traversal_tag category;
typedef typename SingleView::value_type value_type;
typedef SingleView single_view_type;
explicit single_view_iterator(single_view_type const& view)
: val(view.val) {}
value_type val;
};
}}
#endif

View File

@@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_SEQUENCE_VIEW_TRANSFORM_VIEW_10022005_0612)
#define FUSION_SEQUENCE_VIEW_TRANSFORM_VIEW_10022005_0612
#include <boost/fusion/view/transform_view/transform_view.hpp>
#include <boost/fusion/view/transform_view/transform_view_iterator.hpp>
#endif

View File

@@ -0,0 +1,75 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(FUSION_ADVANCE_IMPL_13122005_1906)
#define FUSION_ADVANCE_IMPL_13122005_1906
#include <boost/fusion/iterator/advance.hpp>
namespace boost { namespace fusion
{
struct transform_view_iterator_tag;
struct transform_view_iterator2_tag;
template<typename First, typename F>
struct transform_view_iterator;
template <typename First1, typename First2, typename F>
struct transform_view_iterator2;
namespace extension
{
template<typename Tag>
struct advance_impl;
// Unary Version
template<>
struct advance_impl<transform_view_iterator_tag>
{
template<typename Iterator, typename Dist>
struct apply
{
typedef typename Iterator::first_type first_type;
typedef typename result_of::advance<first_type, Dist>::type advanced_type;
typedef typename Iterator::transform_type transform_type;
typedef transform_view_iterator<advanced_type, transform_type> type;
static type
call(Iterator const& i)
{
return type(boost::fusion::advance<Dist>(i.first), i.f);
}
};
};
// Binary Version
template<>
struct advance_impl<transform_view_iterator2_tag>
{
template<typename Iterator, typename Dist>
struct apply
{
typedef typename Iterator::first1_type first1_type;
typedef typename Iterator::first2_type first2_type;
typedef typename result_of::advance<first1_type, Dist>::type advanced1_type;
typedef typename result_of::advance<first2_type, Dist>::type advanced2_type;
typedef typename Iterator::transform_type transform_type;
typedef transform_view_iterator2<advanced1_type, advanced2_type, transform_type> type;
static type
call(Iterator const& i)
{
return type(
boost::fusion::advance<Dist>(i.first1)
, boost::fusion::advance<Dist>(i.first2), i.f);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,37 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2007 Dan Marsden
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_APPLY_TRANSFORM_RESULT_02092006_1936)
#define BOOST_FUSION_APPLY_TRANSFORM_RESULT_02092006_1936
#include <boost/utility/result_of.hpp>
namespace boost { namespace fusion
{
struct void_;
namespace detail
{
template <typename F>
struct apply_transform_result
{
template <typename T0, typename T1 = void_>
struct apply
: boost::result_of<F(T0, T1)>
{};
template <typename T0>
struct apply<T0, void_>
: boost::result_of<F(T0)>
{};
};
}
}}
#endif

View File

@@ -0,0 +1,63 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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_AT_IMPL_20061029_1946)
#define BOOST_FUSION_AT_IMPL_20061029_1946
#include <boost/mpl/apply.hpp>
#include <boost/fusion/view/transform_view/detail/apply_transform_result.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
namespace boost { namespace fusion {
struct transform_view_tag;
struct transform_view2_tag;
namespace extension
{
template<typename Tag>
struct at_impl;
template<>
struct at_impl<transform_view_tag>
{
template<typename Seq, typename N>
struct apply
{
typedef typename Seq::transform_type F;
typedef detail::apply_transform_result<F> transform_type;
typedef typename boost::fusion::result_of::at<typename Seq::sequence_type, N>::type value_type;
typedef typename mpl::apply<transform_type, value_type>::type type;
static type call(Seq& seq)
{
return seq.f(boost::fusion::at<N>(seq.seq));
}
};
};
template<>
struct at_impl<transform_view2_tag>
{
template<typename Seq, typename N>
struct apply
{
typedef typename Seq::transform_type F;
typedef detail::apply_transform_result<F> transform_type;
typedef typename boost::fusion::result_of::at<typename Seq::sequence1_type, N>::type value1_type;
typedef typename boost::fusion::result_of::at<typename Seq::sequence2_type, N>::type value2_type;
typedef typename mpl::apply<transform_type, value1_type, value2_type>::type type;
static type call(Seq& seq)
{
return seq.f(boost::fusion::at<N>(seq.seq1), boost::fusion::at<N>(seq.seq2));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,68 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_BEGIN_IMPL_07162005_1031)
#define FUSION_BEGIN_IMPL_07162005_1031
#include <boost/fusion/view/transform_view/transform_view_fwd.hpp>
namespace boost { namespace fusion
{
template <typename First, typename F>
struct transform_view_iterator;
template <typename First1, typename First2, typename F>
struct transform_view_iterator2;
namespace extension
{
template <typename Tag>
struct begin_impl;
// Unary Version
template <>
struct begin_impl<transform_view_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::first_type first_type;
typedef typename Sequence::transform_type transform_type;
typedef transform_view_iterator<first_type, transform_type> type;
static type
call(Sequence& s)
{
return type(s.first(), s.f);
}
};
};
// Binary Version
template <>
struct begin_impl<transform_view2_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::first1_type first1_type;
typedef typename Sequence::first2_type first2_type;
typedef typename Sequence::transform_type transform_type;
typedef transform_view_iterator2<first1_type, first2_type, transform_type> type;
static type
call(Sequence& s)
{
return type(s.first1(), s.first2(), s.f);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,76 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_DEREF_IMPL_07162005_1026)
#define FUSION_DEREF_IMPL_07162005_1026
#include <boost/mpl/apply.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/view/transform_view/detail/apply_transform_result.hpp>
namespace boost { namespace fusion
{
struct transform_view_iterator_tag;
struct transform_view_iterator2_tag;
namespace extension
{
template <typename Tag>
struct deref_impl;
// Unary Version
template <>
struct deref_impl<transform_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename
result_of::deref<typename Iterator::first_type>::type
value_type;
typedef detail::apply_transform_result<typename Iterator::transform_type> transform_type;
typedef typename mpl::apply<transform_type, value_type>::type type;
static type
call(Iterator const& i)
{
return i.f(*i.first);
}
};
};
// Binary Version
template <>
struct deref_impl<transform_view_iterator2_tag>
{
template <typename Iterator>
struct apply
{
typedef typename
result_of::deref<typename Iterator::first1_type>::type
value1_type;
typedef typename
result_of::deref<typename Iterator::first2_type>::type
value2_type;
typedef detail::apply_transform_result<typename Iterator::transform_type> transform_type;
typedef typename mpl::apply<transform_type, value1_type, value2_type>::type type;
static type
call(Iterator const& i)
{
return i.f(*i.first1, *i.first2);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,59 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(FUSION_DISTANCE_IMPL_13122005_2139)
#define FUSION_DISTANCE_IMPL_13122005_2139
#include <boost/fusion/iterator/distance.hpp>
namespace boost { namespace fusion {
struct transform_view_iterator_tag;
struct transform_view_iterator2_tag;
namespace extension
{
template<typename Tag>
struct distance_impl;
// Unary Version
template<>
struct distance_impl<transform_view_iterator_tag>
{
template<typename First, typename Last>
struct apply
: result_of::distance<typename First::first_type, typename Last::first_type>
{
static
typename result_of::distance<typename First::first_type, typename Last::first_type>::type
call(First const& first, Last const& last)
{
return boost::fusion::distance(first.first, last.first);
}
};
};
// Binary Version
template<>
struct distance_impl<transform_view_iterator2_tag>
{
template<typename First, typename Last>
struct apply
: result_of::distance<typename First::first1_type, typename Last::first1_type>
{
static
typename result_of::distance<typename First::first1_type, typename Last::first1_type>::type
call(First const& first, Last const& last)
{
return boost::fusion::distance(first.first1, last.first1);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,68 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_END_IMPL_07162005_1028)
#define FUSION_END_IMPL_07162005_1028
#include <boost/fusion/view/transform_view/transform_view_fwd.hpp>
namespace boost { namespace fusion
{
template <typename First, typename F>
struct transform_view_iterator;
template <typename First1, typename First2, typename F>
struct transform_view_iterator2;
namespace extension
{
template <typename Tag>
struct end_impl;
// Unary Version
template <>
struct end_impl<transform_view_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::last_type last_type;
typedef typename Sequence::transform_type transform_type;
typedef transform_view_iterator<last_type, transform_type> type;
static type
call(Sequence& s)
{
return type(s.last(), s.f);
}
};
};
// Binary Version
template <>
struct end_impl<transform_view2_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::last1_type last1_type;
typedef typename Sequence::last2_type last2_type;
typedef typename Sequence::transform_type transform_type;
typedef transform_view_iterator2<last1_type, last2_type, transform_type> type;
static type
call(Sequence& s)
{
return type(s.last1(), s.last2(), s.f);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,42 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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_TRANSFORM_VIEW_ITERATOR_20070127_0957)
#define BOOST_FUSION_TRANSFORM_VIEW_ITERATOR_20070127_0957
#include <boost/fusion/iterator/equal_to.hpp>
namespace boost { namespace fusion {
struct transform_view_iterator_tag;
struct transform_view_iterator2_tag;
namespace extension
{
template<typename Tag>
struct equal_to_impl;
template<>
struct equal_to_impl<transform_view_iterator_tag>
{
template<typename It1, typename It2>
struct apply
: result_of::equal_to<typename It1::first_type, typename It2::first_type>
{};
};
template<>
struct equal_to_impl<transform_view_iterator2_tag>
{
template<typename It1, typename It2>
struct apply
: result_of::equal_to<typename It1::first1_type, typename It2::first1_type>
{};
};
}
}}
#endif

View File

@@ -0,0 +1,74 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_NEXT_IMPL_07162005_1029)
#define FUSION_NEXT_IMPL_07162005_1029
#include <boost/fusion/iterator/next.hpp>
namespace boost { namespace fusion
{
struct transform_view_iterator_tag;
struct transform_view_iterator2_tag;
template<typename First, typename F>
struct transform_view_iterator;
template <typename First1, typename First2, typename F>
struct transform_view_iterator2;
namespace extension
{
template <typename Tag>
struct next_impl;
// Unary Version
template <>
struct next_impl<transform_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::first_type first_type;
typedef typename result_of::next<first_type>::type next_type;
typedef typename Iterator::transform_type transform_type;
typedef transform_view_iterator<next_type, transform_type> type;
static type
call(Iterator const& i)
{
return type(fusion::next(i.first), i.f);
}
};
};
// Binary Version
template <>
struct next_impl<transform_view_iterator2_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::first1_type first1_type;
typedef typename Iterator::first2_type first2_type;
typedef typename result_of::next<first1_type>::type next1_type;
typedef typename result_of::next<first2_type>::type next2_type;
typedef typename Iterator::transform_type transform_type;
typedef transform_view_iterator2<next1_type, next2_type, transform_type> type;
static type
call(Iterator const& i)
{
return type(fusion::next(i.first1), fusion::next(i.first2), i.f);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,73 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(FUSION_PREV_IMPL_13122005_2110)
#define FUSION_PREV_IMPL_13122005_2110
#include <boost/fusion/iterator/prior.hpp>
namespace boost { namespace fusion
{
struct transform_view_iterator_tag;
struct transform_view_iterator2_tag;
template<typename First, typename F>
struct transform_view_iterator;
template <typename First1, typename First2, typename F>
struct transform_view_iterator2;
namespace extension
{
template<typename Tag>
struct prior_impl;
// Unary Version
template<>
struct prior_impl<transform_view_iterator_tag>
{
template<typename Iterator>
struct apply
{
typedef typename Iterator::first_type first_type;
typedef typename result_of::prior<first_type>::type prior_type;
typedef typename Iterator::transform_type transform_type;
typedef transform_view_iterator<prior_type, transform_type> type;
static type
call(Iterator const& i)
{
return type(fusion::prior(i.first), i.f);
}
};
};
// Binary Version
template<>
struct prior_impl<transform_view_iterator2_tag>
{
template<typename Iterator>
struct apply
{
typedef typename Iterator::first1_type first1_type;
typedef typename Iterator::first2_type first2_type;
typedef typename result_of::prior<first1_type>::type prior1_type;
typedef typename result_of::prior<first2_type>::type prior2_type;
typedef typename Iterator::transform_type transform_type;
typedef transform_view_iterator2<prior1_type, prior2_type, transform_type> type;
static type
call(Iterator const& i)
{
return type(fusion::prior(i.first1), fusion::prior(i.first2), i.f);
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,53 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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_VALUE_AT_IMPL_20061101_0745)
#define BOOST_FUSION_VALUE_AT_IMPL_20061101_0745
#include <boost/mpl/apply.hpp>
#include <boost/fusion/view/transform_view/detail/apply_transform_result.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
namespace boost { namespace fusion {
struct transform_view_tag;
struct transform_view2_tag;
namespace extension
{
template<typename Tag>
struct value_at_impl;
template<>
struct value_at_impl<transform_view_tag>
{
template<typename Seq, typename N>
struct apply
{
typedef typename Seq::transform_type F;
typedef detail::apply_transform_result<F> transform_type;
typedef typename boost::fusion::result_of::at<typename Seq::sequence_type, N>::type value_type;
typedef typename mpl::apply<transform_type, value_type>::type type;
};
};
template<>
struct value_at_impl<transform_view2_tag>
{
template<typename Seq, typename N>
struct apply
{
typedef typename Seq::transform_type F;
typedef detail::apply_transform_result<F> transform_type;
typedef typename boost::fusion::result_of::at<typename Seq::sequence1_type, N>::type value1_type;
typedef typename boost::fusion::result_of::at<typename Seq::sequence2_type, N>::type value2_type;
typedef typename mpl::apply<transform_type, value1_type, value2_type>::type type;
};
};
}
}}
#endif

View File

@@ -0,0 +1,63 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_VALUE_OF_IMPL_07162005_1030)
#define FUSION_VALUE_OF_IMPL_07162005_1030
#include <boost/mpl/apply.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/view/transform_view/detail/apply_transform_result.hpp>
namespace boost { namespace fusion
{
struct transform_view_iterator_tag;
struct transform_view_iterator2_tag;
namespace extension
{
template <typename Tag>
struct value_of_impl;
// Unary Version
template <>
struct value_of_impl<transform_view_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename
result_of::value_of<typename Iterator::first_type>::type
value_type;
typedef detail::apply_transform_result<typename Iterator::transform_type> transform_type;
typedef typename mpl::apply<transform_type, value_type>::type type;
};
};
// Binary Version
template <>
struct value_of_impl<transform_view_iterator2_tag>
{
template <typename Iterator>
struct apply
{
typedef typename
result_of::value_of<typename Iterator::first1_type>::type
value1_type;
typedef typename
result_of::value_of<typename Iterator::first2_type>::type
value2_type;
typedef detail::apply_transform_result<typename Iterator::transform_type> transform_type;
typedef typename mpl::apply<transform_type, value1_type, value2_type>::type type;
};
};
}
}}
#endif

View File

@@ -0,0 +1,99 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_TRANSFORM_VIEW_07162005_1037)
#define FUSION_TRANSFORM_VIEW_07162005_1037
#include <boost/static_assert.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/is_view.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/view/transform_view/transform_view_iterator.hpp>
#include <boost/fusion/view/transform_view/transform_view_fwd.hpp>
#include <boost/fusion/view/transform_view/detail/begin_impl.hpp>
#include <boost/fusion/view/transform_view/detail/end_impl.hpp>
#include <boost/fusion/view/transform_view/detail/at_impl.hpp>
#include <boost/fusion/view/transform_view/detail/value_at_impl.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct void_;
struct transform_view_tag;
struct transform_view2_tag;
struct fusion_sequence_tag;
// Binary Version
template <typename Sequence1, typename Sequence2, typename F>
struct transform_view : sequence_base<transform_view<Sequence1, Sequence2, F> >
{
BOOST_STATIC_ASSERT(result_of::size<Sequence1>::value == result_of::size<Sequence2>::value);
typedef transform_view2_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef typename traits::category_of<Sequence1>::type category1;
typedef typename traits::category_of<Sequence2>::type category2;
typedef typename result_of::begin<Sequence1>::type first1_type;
typedef typename result_of::begin<Sequence2>::type first2_type;
typedef typename result_of::end<Sequence1>::type last1_type;
typedef typename result_of::end<Sequence2>::type last2_type;
typedef typename result_of::size<Sequence1>::type size;
typedef Sequence1 sequence1_type;
typedef Sequence2 sequence2_type;
typedef F transform_type;
transform_view(Sequence1& seq1, Sequence2& seq2, F const& binop)
: f(binop)
, seq1(seq1)
, seq2(seq2)
{}
first1_type first1() const { return fusion::begin(seq1); }
first2_type first2() const { return fusion::begin(seq2); }
last1_type last1() const { return fusion::end(seq1); }
last2_type last2() const { return fusion::end(seq2); }
transform_type f;
typename mpl::if_<traits::is_view<Sequence1>, Sequence1, Sequence1&>::type seq1;
typename mpl::if_<traits::is_view<Sequence2>, Sequence2, Sequence2&>::type seq2;
};
// Unary Version
template <typename Sequence, typename F>
struct transform_view<Sequence, F> : sequence_base<transform_view<Sequence, F> >
{
typedef transform_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef typename traits::category_of<Sequence>::type category;
typedef typename result_of::begin<Sequence>::type first_type;
typedef typename result_of::end<Sequence>::type last_type;
typedef typename result_of::size<Sequence>::type size;
typedef Sequence sequence_type;
typedef F transform_type;
transform_view(Sequence& seq, F const& f)
: seq(seq)
, f(f)
{}
first_type first() const { return fusion::begin(seq); }
last_type last() const { return fusion::end(seq); }
typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq;
transform_type f;
};
}}
#endif

View File

@@ -0,0 +1,22 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_TRANSFORM_VIEW_FORWARD_01052006_1839)
#define FUSION_TRANSFORM_VIEW_FORWARD_01052006_1839
namespace boost { namespace fusion
{
struct void_;
struct transform_view_tag;
struct transform_view2_tag;
template <typename A, typename B, typename C = void_>
struct transform_view;
}}
#endif

View File

@@ -0,0 +1,69 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_TRANSFORM_VIEW_ITERATOR_07162005_1033)
#define FUSION_TRANSFORM_VIEW_ITERATOR_07162005_1033
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/fusion/view/transform_view/detail/deref_impl.hpp>
#include <boost/fusion/view/transform_view/detail/next_impl.hpp>
#include <boost/fusion/view/transform_view/detail/prior_impl.hpp>
#include <boost/fusion/view/transform_view/detail/value_of_impl.hpp>
#include <boost/fusion/view/transform_view/detail/advance_impl.hpp>
#include <boost/fusion/view/transform_view/detail/distance_impl.hpp>
#include <boost/fusion/view/transform_view/detail/equal_to_impl.hpp>
namespace boost { namespace fusion
{
// Unary Version
struct transform_view_iterator_tag;
template <typename First, typename F>
struct transform_view_iterator
: iterator_base<transform_view_iterator<First, F> >
{
typedef transform_view_iterator_tag fusion_tag;
typedef convert_iterator<First> converter;
typedef typename converter::type first_type;
typedef typename traits::category_of<first_type>::type category;
typedef F transform_type;
transform_view_iterator(First const& first, F const& f)
: first(converter::call(first)), f(f) {}
first_type first;
transform_type f;
};
// Binary Version
struct transform_view_iterator2_tag;
template <typename First1, typename First2, typename F>
struct transform_view_iterator2
: iterator_base<transform_view_iterator2<First1, First2, F> >
{
typedef transform_view_iterator2_tag fusion_tag;
typedef convert_iterator<First1> converter1;
typedef convert_iterator<First2> converter2;
typedef typename converter1::type first1_type;
typedef typename converter2::type first2_type;
typedef typename traits::category_of<first1_type>::type category;
typedef F transform_type;
transform_view_iterator2(First1 const& first1, First2 const& first2, F const& f)
: first1(converter1::call(first1)), first2(converter2::call(first2)), f(f) {}
first1_type first1;
first2_type first2;
transform_type f;
};
}}
#endif

View File

@@ -0,0 +1,14 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_ZIP_VIEW_23012006_0811)
#define FUSION_ZIP_VIEW_23012006_0811
#include <boost/fusion/view/zip_view/zip_view.hpp>
#include <boost/fusion/view/zip_view/zip_view_iterator.hpp>
#endif

View File

@@ -0,0 +1,69 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_ADVANCE_IMPL_20061024_2021)
#define FUSION_ADVANCE_IMPL_20061024_2021
#include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost { namespace fusion {
struct zip_view_iterator_tag;
namespace detail
{
template<typename N>
struct poly_advance
{
template<typename Sig>
struct result;
template<typename N1, typename It>
struct result<poly_advance<N1>(It)>
{
typedef typename remove_reference<It>::type it;
typedef typename result_of::advance<it,N>::type type;
};
template<typename It>
typename result<poly_advance(It)>::type
operator()(const It& it) const
{
return fusion::advance<N>(it);
}
};
}
namespace extension
{
template<typename Tag>
struct advance_impl;
template<>
struct advance_impl<zip_view_iterator_tag>
{
template<typename It, typename N>
struct apply
{
typedef zip_view_iterator<
typename result_of::transform<typename It::iterators, detail::poly_advance<N> >::type> type;
static type
call(It const& it)
{
return type(
fusion::transform(it.iterators_, detail::poly_advance<N>()));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,92 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_AT_IMPL_20060124_1933)
#define FUSION_AT_IMPL_20060124_1933
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/container/vector/convert.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/fusion/support/unused.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace fusion
{
struct zip_view_tag;
namespace detail
{
template<typename N>
struct poly_at
{
template<typename T>
struct result;
template<typename N1, typename SeqRef>
struct result<poly_at<N1>(SeqRef)>
: mpl::eval_if<is_same<SeqRef, unused_type const&>,
mpl::identity<unused_type>,
result_of::at<typename remove_reference<SeqRef>::type, N> >
{
BOOST_MPL_ASSERT((is_reference<SeqRef>));
};
template<typename Seq>
typename result<poly_at(Seq&)>::type
operator()(Seq& seq) const
{
return fusion::at<N>(seq);
}
template<typename Seq>
typename result<poly_at(Seq const&)>::type
operator()(Seq const& seq) const
{
return fusion::at<N>(seq);
}
unused_type operator()(unused_type const&) const
{
return unused_type();
}
};
}
namespace extension
{
template<typename Tag>
struct at_impl;
template<>
struct at_impl<zip_view_tag>
{
template<typename Seq, typename N>
struct apply
{
typedef typename result_of::as_vector<
typename result_of::transform<
typename Seq::sequences, detail::poly_at<N> >::type>::type type;
static type
call(Seq& seq)
{
return type(
fusion::transform(seq.sequences_, detail::poly_at<N>()));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,92 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_BEGIN_IMPL_20060123_2147)
#define FUSION_BEGIN_IMPL_20060123_2147
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/fusion/support/unused.hpp>
namespace boost { namespace fusion {
struct zip_view_tag;
namespace detail
{
struct poly_begin
{
template<typename T>
struct result;
template<typename SeqRef>
struct result<poly_begin(SeqRef)>
: mpl::eval_if<is_same<SeqRef, unused_type const&>,
mpl::identity<unused_type>,
result_of::begin<typename remove_reference<SeqRef>::type> >
{
BOOST_MPL_ASSERT((is_reference<SeqRef>));
};
template<typename Seq>
typename result<poly_begin(Seq&)>::type
operator()(Seq& seq) const
{
return fusion::begin(seq);
}
template<typename Seq>
typename result<poly_begin(Seq const&)>::type
operator()(Seq const& seq) const
{
return fusion::begin(seq);
}
unused_type operator()(unused_type const&) const
{
return unused_type();
}
};
}
namespace extension
{
template<typename Tag>
struct begin_impl;
template<>
struct begin_impl<zip_view_tag>
{
template<typename Sequence>
struct apply
{
typedef zip_view_iterator<
typename result_of::transform<typename Sequence::sequences, detail::poly_begin>::type,
typename Sequence::category> type;
static type
call(Sequence& sequence)
{
return type(
fusion::transform(sequence.sequences_, detail::poly_begin()));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,83 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_DEREF_IMPL_20061024_1959)
#define FUSION_DEREF_IMPL_20061024_1959
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/container/vector/convert.hpp>
#include <boost/fusion/support/unused.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion {
struct zip_view_iterator_tag;
namespace detail
{
struct poly_deref
{
template<typename Sig>
struct result;
template<typename It>
struct result<poly_deref(It)>
{
typedef typename remove_const<
typename remove_reference<It>::type>::type it;
typedef typename mpl::eval_if<is_same<it, unused_type>,
mpl::identity<unused_type>,
result_of::deref<it> >::type type;
};
template<typename It>
typename result<poly_deref(It)>::type
operator()(const It& it) const
{
return fusion::deref(it);
}
unused_type operator()(unused_type const&) const
{
return unused_type();
}
};
}
namespace extension
{
template<typename Tag>
struct deref_impl;
template<>
struct deref_impl<zip_view_iterator_tag>
{
template<typename It>
struct apply
{
typedef typename result_of::as_vector<
typename result_of::transform<typename It::iterators, detail::poly_deref>::type>::type type;
static type
call(It const& it)
{
return type(
fusion::transform(it.iterators_, detail::poly_deref()));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,82 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_DISTANCE_IMPL_20060124_2033)
#define FUSION_DISTANCE_IMPL_20060124_2033
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/algorithm/query/find_if.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace fusion {
struct zip_view_iterator_tag;
struct random_access_iterator_tag;
namespace detail
{
template<typename FoundIt, typename SearchIt>
struct best_distance
{
typedef typename result_of::find_if<
typename SearchIt::iterators, is_same<traits::category_of<mpl::_>, random_access_iterator_tag> > finder;
BOOST_MPL_ASSERT_NOT((is_same<typename finder::type, result_of::end<typename SearchIt::iterators> >));
typedef typename result_of::distance<FoundIt, typename finder::type>::type type;
};
template<typename It1, typename It2>
struct default_distance
: result_of::distance<
typename result_of::value_at_c<typename It1::iterators, 0>::type,
typename result_of::value_at_c<typename It2::iterators, 0>::type>
{};
template<typename It1, typename It2>
struct zip_view_iterator_distance
{
typedef typename result_of::find_if<
typename It1::iterators, is_same<traits::category_of<mpl::_>, random_access_iterator_tag> > finder;
typedef typename mpl::eval_if<
is_same<typename finder::type, typename result_of::end<typename It1::iterators>::type>,
detail::default_distance<It1, It2> ,
detail::best_distance<typename finder::type, It2> >::type type;
};
}
namespace extension
{
template<typename Tag>
struct distance_impl;
template<>
struct distance_impl<zip_view_iterator_tag>
{
template<typename It1, typename It2>
struct apply
: detail::zip_view_iterator_distance<It1, It2>::type
{
static typename detail::zip_view_iterator_distance<It1, It2>::type
call(It1 const& it1, It2 const& it2)
{
return typename detail::zip_view_iterator_distance<It1, It2>::type();
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,103 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_END_IMPL_20060123_2208)
#define FUSION_END_IMPL_20060123_2208
#include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/sequence/intrinsic/front.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/min.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace fusion {
struct zip_view_tag;
namespace detail
{
template<typename SeqRef, typename M>
struct get_endpoint
{
typedef typename remove_reference<SeqRef>::type Seq;
typedef typename result_of::begin<Seq>::type begin;
typedef typename result_of::advance<begin, M>::type type;
};
template<typename M>
struct endpoints
{
template<typename T>
struct result;
template<typename M1, typename SeqRef>
struct result<endpoints<M1>(SeqRef)>
: mpl::eval_if<is_same<SeqRef, unused_type const&>,
mpl::identity<unused_type>,
get_endpoint<SeqRef, M> >
{
BOOST_MPL_ASSERT((is_reference<SeqRef>));
};
template<typename Seq>
typename result<endpoints(Seq&)>::type
operator()(Seq& seq) const
{
return fusion::advance<M>(fusion::begin(seq));
}
template<typename Seq>
typename result<endpoints(Seq const&)>::type
operator()(Seq const& seq)
{
return fusion::advance<M>(fusion::begin(seq));
}
unused_type operator()(unused_type const&) const
{
return unused_type();
}
};
}
namespace extension
{
template<typename Tag>
struct end_impl;
template<>
struct end_impl<zip_view_tag>
{
template<typename Sequence>
struct apply
{
typedef zip_view_iterator<
typename result_of::transform<typename Sequence::sequences, detail::endpoints<typename Sequence::size> >::type,
typename Sequence::category> type;
static type
call(Sequence& sequence)
{
return type(
fusion::transform(sequence.sequences_, detail::endpoints<typename Sequence::size>()));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,62 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_EQUAL_TO_IMPL_20060128_1423)
#define FUSION_EQUAL_TO_IMPL_20060128_1423
#include <boost/fusion/mpl.hpp>
#include <boost/mpl/lambda.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/transform_view.hpp>
#include <boost/mpl/zip_view.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/unpack_args.hpp>
#include <boost/mpl/find_if.hpp>
#include <boost/mpl/end.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
namespace boost { namespace fusion {
struct zip_view_iterator_tag;
namespace detail
{
template<typename It1, typename It2>
struct zip_iterators_equal
{
typedef mpl::zip_view<mpl::vector2<typename It1::iterators, typename It2::iterators> > zipped;
typedef mpl::transform_view<zipped, mpl::unpack_args<result_of::equal_to<mpl::_,mpl::_> > > transformed;
typedef typename mpl::find_if<transformed, mpl::equal_to<mpl::_, mpl::false_> >::type found;
typedef typename is_same<typename mpl::end<transformed>::type, found>::type type;
};
}
namespace extension
{
template<typename Tag>
struct equal_to_impl;
template<>
struct equal_to_impl<zip_view_iterator_tag>
{
template<typename It1, typename It2>
struct apply
: detail::zip_iterators_equal<It1, It2>::type
{};
};
}
}}
#endif

View File

@@ -0,0 +1,83 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_NEXT_IMPL_20060124_2006)
#define FUSION_NEXT_IMPL_20060124_2006
#include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/support/unused.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion {
struct zip_view_iterator_tag;
namespace detail
{
struct poly_next
{
template<typename Sig>
struct result;
template<typename It>
struct result<poly_next(It)>
{
typedef typename remove_const<
typename remove_reference<It>::type>::type it;
typedef typename mpl::eval_if<is_same<it, unused_type>,
mpl::identity<unused_type>,
result_of::next<it> >::type type;
};
template<typename It>
typename result<poly_next(It)>::type
operator()(const It& it) const
{
return fusion::next(it);
}
unused_type operator()(unused_type const&) const
{
return unused_type();
}
};
}
namespace extension
{
template<typename Tag>
struct next_impl;
template<>
struct next_impl<zip_view_iterator_tag>
{
template<typename Iterator>
struct apply
{
typedef fusion::zip_view_iterator<
typename result_of::transform<typename Iterator::iterators, detail::poly_next>::type,
typename Iterator::category> type;
static type
call(Iterator const& it)
{
return type(
fusion::transform(it.iterators_, detail::poly_next()));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,83 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_PRIOR_IMPL_20060124_2006)
#define FUSION_PRIOR_IMPL_20060124_2006
#include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/support/unused.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion {
struct zip_view_iterator_tag;
namespace detail
{
struct poly_prior
{
template<typename Sig>
struct result;
template<typename It>
struct result<poly_prior(It)>
{
typedef typename remove_const<
typename remove_reference<It>::type>::type it;
typedef typename mpl::eval_if<is_same<it, unused_type>,
mpl::identity<unused_type>,
result_of::prior<it> >::type type;
};
template<typename It>
typename result<poly_prior(It)>::type
operator()(const It& it) const
{
return fusion::prior(it);
}
unused_type operator()(unused_type const&) const
{
return unused_type();
}
};
}
namespace extension
{
template<typename Tag>
struct prior_impl;
template<>
struct prior_impl<zip_view_iterator_tag>
{
template<typename Iterator>
struct apply
{
typedef zip_view_iterator<
typename result_of::transform<typename Iterator::iterators, detail::poly_prior>::type,
typename Iterator::category> type;
static type
call(Iterator const& it)
{
return type(
fusion::transform(it.iterators_, detail::poly_prior()));
}
};
};
}
}}
#endif

View File

@@ -0,0 +1,35 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_SIZE_IMPL_20060124_0800)
#define FUSION_SIZE_IMPL_20060124_0800
namespace boost { namespace fusion {
struct zip_view_tag;
namespace extension
{
template<typename Sequence>
struct size;
template<typename Tag>
struct size_impl;
template<>
struct size_impl<zip_view_tag>
{
template<typename Sequence>
struct apply
{
typedef typename Sequence::size type;
};
};
}
}}
#endif

View File

@@ -0,0 +1,68 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_STRICTEST_TRAVERSAL_20060123_2101)
#define FUSION_STRICTEST_TRAVERSAL_20060123_2101
#include <boost/mpl/or.hpp>
#include <boost/mpl/if.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/mpl.hpp>
#include <boost/fusion/algorithm/iteration/fold.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_convertible.hpp>
namespace boost { namespace fusion
{
struct forward_traversal_tag;
struct bidirectional_traversal_tag;
struct random_access_traversal_tag;
namespace detail
{
template<typename Tag1, typename Tag2,
bool Tag1Stricter = boost::is_convertible<Tag2,Tag1>::value>
struct stricter_traversal
{
typedef Tag1 type;
};
template<typename Tag1, typename Tag2>
struct stricter_traversal<Tag1,Tag2,false>
{
typedef Tag2 type;
};
struct strictest_traversal_impl
{
template<typename Sig>
struct result;
template<typename Next, typename StrictestSoFar>
struct result<strictest_traversal_impl(Next, StrictestSoFar)>
{
typedef typename remove_reference<Next>::type next_value;
typedef typename remove_reference<StrictestSoFar>::type strictest_so_far;
typedef strictest_so_far tag1;
typedef typename traits::category_of<next_value>::type tag2;
typedef typename stricter_traversal<tag1,tag2>::type type;
};
};
template<typename Sequence>
struct strictest_traversal
: result_of::fold<
Sequence, fusion::random_access_traversal_tag,
strictest_traversal_impl>
{};
}
}}
#endif

View File

@@ -0,0 +1,61 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_VALUE_AT_IMPL_20060124_2129)
#define FUSION_VALUE_AT_IMPL_20060124_2129
#include <boost/fusion/container/vector/convert.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/support/unused.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace fusion {
struct zip_view_tag;
namespace detail
{
template<typename N>
struct poly_value_at
{
template<typename T>
struct result;
template<typename N1, typename Seq>
struct result<poly_value_at<N1>(Seq)>
: mpl::eval_if<is_same<Seq, unused_type const&>,
mpl::identity<unused_type>,
result_of::value_at<typename remove_reference<Seq>::type, N> >
{};
};
}
namespace extension
{
template<typename Tag>
struct value_at_impl;
template<>
struct value_at_impl<zip_view_tag>
{
template<typename Sequence, typename N>
struct apply
{
typedef typename result_of::transform<
typename Sequence::sequences,
detail::poly_value_at<N> >::type values;
typedef typename result_of::as_vector<values>::type type;
};
};
}
}}
#endif

View File

@@ -0,0 +1,61 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_VALUE_OF_IMPL_20060124_2147)
#define FUSION_VALUE_OF_IMPL_20060124_2147
#include <boost/fusion/container/vector/convert.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/fusion/support/unused.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace fusion
{
struct zip_view_iterator_tag;
namespace detail
{
struct poly_value_of
{
template<typename T>
struct result;
template<typename It>
struct result<poly_value_of(It)>
: mpl::eval_if<is_same<It, unused_type>,
mpl::identity<unused_type>,
result_of::value_of<It> >
{};
};
}
namespace extension
{
template<typename Tag>
struct value_of_impl;
template<>
struct value_of_impl<zip_view_iterator_tag>
{
template<typename Iterator>
struct apply
{
typedef typename result_of::transform<
typename Iterator::iterators,
detail::poly_value_of>::type values;
typedef typename result_of::as_vector<values>::type type;
};
};
}
}}
#endif

View File

@@ -0,0 +1,115 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_ZIP_VIEW_23012006_0813)
#define FUSION_ZIP_VIEW_23012006_0813
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/unused.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/view/zip_view/detail/strictest_traversal.hpp>
#include <boost/fusion/view/zip_view/detail/begin_impl.hpp>
#include <boost/fusion/view/zip_view/detail/end_impl.hpp>
#include <boost/fusion/view/zip_view/detail/size_impl.hpp>
#include <boost/fusion/view/zip_view/detail/at_impl.hpp>
#include <boost/fusion/view/zip_view/detail/value_at_impl.hpp>
#include <boost/fusion/container/vector/convert.hpp>
#include <boost/fusion/algorithm/query/find_if.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/mpl.hpp>
#include <boost/fusion/algorithm/transformation/remove.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/transform_view.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/find_if.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_reference.hpp>
namespace boost { namespace fusion {
namespace detail
{
template<typename Sequences>
struct all_references
: fusion::result_of::equal_to<typename fusion::result_of::find_if<Sequences, mpl::not_<is_reference<mpl::_> > >::type, typename fusion::result_of::end<Sequences>::type>
{};
struct seq_ref_size
{
template<typename Params>
struct result;
template<typename Seq>
struct result<seq_ref_size(Seq)>
{
static int const high_int = static_cast<int>(
(static_cast<unsigned>(~0) >> 1) - 1);
typedef typename remove_reference<Seq>::type SeqClass;
typedef typename mpl::eval_if<
traits::is_forward<SeqClass>,
result_of::size<SeqClass>,
mpl::int_<high_int> >::type type;
};
};
struct poly_min
{
template<typename T>
struct result;
template<typename Lhs, typename Rhs>
struct result<poly_min(Lhs, Rhs)>
{
typedef typename remove_reference<Lhs>::type lhs;
typedef typename remove_reference<Rhs>::type rhs;
typedef typename mpl::min<lhs, rhs>::type type;
};
};
template<typename Sequences>
struct min_size
{
typedef typename result_of::transform<Sequences, detail::seq_ref_size>::type sizes;
typedef typename result_of::fold<sizes, typename result_of::front<sizes>::type, detail::poly_min>::type type;
};
}
struct zip_view_tag;
struct fusion_sequence_tag;
template<typename Sequences>
struct zip_view : sequence_base< zip_view<Sequences> >
{
typedef typename result_of::remove<Sequences, unused_type const&>::type real_sequences;
BOOST_MPL_ASSERT((detail::all_references<Sequences>));
typedef typename detail::strictest_traversal<real_sequences>::type category;
typedef zip_view_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::true_ is_view;
typedef typename fusion::result_of::as_vector<Sequences>::type sequences;
typedef typename detail::min_size<real_sequences>::type size;
zip_view(
const Sequences& seqs)
: sequences_(seqs)
{};
sequences sequences_;
};
}}
#endif

View File

@@ -0,0 +1,47 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_ZIP_VIEW_ITERATOR_23012006_0814)
#define FUSION_ZIP_VIEW_ITERATOR_23012006_0814
#include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/view/zip_view/detail/deref_impl.hpp>
#include <boost/fusion/view/zip_view/detail/next_impl.hpp>
#include <boost/fusion/view/zip_view/detail/prior_impl.hpp>
#include <boost/fusion/view/zip_view/detail/advance_impl.hpp>
#include <boost/fusion/view/zip_view/detail/distance_impl.hpp>
#include <boost/fusion/view/zip_view/detail/value_of_impl.hpp>
#include <boost/fusion/view/zip_view/detail/equal_to_impl.hpp>
#include <boost/fusion/container/vector/convert.hpp>
namespace boost { namespace fusion {
struct zip_view_iterator_tag;
template<
typename IteratorSequence,
typename Traversal>
struct zip_view_iterator
: iterator_base<zip_view_iterator<IteratorSequence, Traversal> >
{
typedef zip_view_iterator_tag fusion_tag;
typedef Traversal category;
template<typename InitSeq>
zip_view_iterator(
const InitSeq& iterator_seq)
: iterators_(iterator_seq)
{}
typedef typename result_of::as_vector<IteratorSequence>::type iterators;
iterators iterators_;
};
}}
#endif

View File

@@ -0,0 +1,22 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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(FUSION_ZIP_VIEW_ITERATOR_FWD)
#define FUSION_ZIP_VIEW_ITERATOR_FWD
#include <boost/fusion/view/zip_view/detail/strictest_traversal.hpp>
namespace boost { namespace fusion {
template<
typename IteratorSequence,
typename Traversal = typename detail::strictest_traversal<IteratorSequence>::type>
struct zip_view_iterator;
}}
#endif