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