forked from boostorg/fusion
Initial move from Spirit CVS
[SVN r34896]
This commit is contained in:
14
include/boost/fusion/sequence/view/filter_view.hpp
Normal file
14
include/boost/fusion/sequence/view/filter_view.hpp
Normal file
@@ -0,0 +1,14 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_SEQUENCE_VIEW_FILTER_VIEW_10022005_0608)
|
||||
#define FUSION_SEQUENCE_VIEW_FILTER_VIEW_10022005_0608
|
||||
|
||||
#include <boost/fusion/sequence/view/filter_view/filter_view.hpp>
|
||||
#include <boost/fusion/sequence/view/filter_view/filter_view_iterator.hpp>
|
||||
|
||||
#endif
|
@@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,30 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,45 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,35 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
@@ -0,0 +1,65 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,39 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,30 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,52 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/view/filter_view/filter_view_iterator.hpp>
|
||||
#include <boost/fusion/sequence/view/filter_view/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/filter_view/detail/end_impl.hpp>
|
||||
#include <boost/fusion/sequence/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_sequence_tag;
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
template <typename Sequence, typename Pred>
|
||||
struct filter_view : sequence_base<filter_view<Sequence, Pred> >
|
||||
{
|
||||
typedef filter_view_tag ftag;
|
||||
typedef fusion_sequence_tag tag; // this gets picked up by MPL
|
||||
typedef forward_sequence_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
|
||||
|
||||
|
@@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/support/iterator_base.hpp>
|
||||
#include <boost/fusion/sequence/view/filter_view/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/filter_view/detail/next_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/filter_view/detail/value_of_impl.hpp>
|
||||
#include <boost/fusion/sequence/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 ftag;
|
||||
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
|
||||
|
||||
|
13
include/boost/fusion/sequence/view/iterator_range.hpp
Normal file
13
include/boost/fusion/sequence/view/iterator_range.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_SEQUENCE_VIEW_ITERATOR_RANGE_10022005_0610)
|
||||
#define FUSION_SEQUENCE_VIEW_ITERATOR_RANGE_10022005_0610
|
||||
|
||||
#include <boost/fusion/sequence/view/iterator_range/iterator_range.hpp>
|
||||
|
||||
#endif
|
@@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,53 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ITERATOR_RANGE_05062005_1224)
|
||||
#define FUSION_ITERATOR_RANGE_05062005_1224
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/fusion/support/detail/iterator_to_sequence_category.hpp>
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/sequence/view/iterator_range/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/iterator_range/detail/end_impl.hpp>
|
||||
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
|
||||
#include <boost/fusion/iterator/distance.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 ftag;
|
||||
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
|
||||
detail::iterator_to_sequence_category<
|
||||
typename traits::category_of<begin_type>::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
|
||||
|
||||
|
14
include/boost/fusion/sequence/view/joint_view.hpp
Normal file
14
include/boost/fusion/sequence/view/joint_view.hpp
Normal file
@@ -0,0 +1,14 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_SEQUENCE_VIEW_JOINT_VIEW_10022005_0610)
|
||||
#define FUSION_SEQUENCE_VIEW_JOINT_VIEW_10022005_0610
|
||||
|
||||
#include <boost/fusion/sequence/view/joint_view/joint_view.hpp>
|
||||
#include <boost/fusion/sequence/view/joint_view/joint_view_iterator.hpp>
|
||||
|
||||
#endif
|
@@ -0,0 +1,67 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
@@ -0,0 +1,30 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,41 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
@@ -0,0 +1,71 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,30 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
62
include/boost/fusion/sequence/view/joint_view/joint_view.hpp
Normal file
62
include/boost/fusion/sequence/view/joint_view/joint_view.hpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/view/joint_view/joint_view_iterator.hpp>
|
||||
#include <boost/fusion/sequence/view/joint_view/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/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_sequence_tag;
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
template <typename Sequence1, typename Sequence2>
|
||||
struct joint_view : sequence_base<joint_view<Sequence1, Sequence2> >
|
||||
{
|
||||
typedef joint_view_tag ftag;
|
||||
typedef fusion_sequence_tag tag; // this gets picked up by MPL
|
||||
typedef forward_sequence_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
|
||||
|
||||
|
@@ -0,0 +1,52 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/view/joint_view/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/joint_view/detail/next_impl.hpp>
|
||||
#include <boost/fusion/sequence/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 ftag;
|
||||
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
|
||||
|
||||
|
14
include/boost/fusion/sequence/view/reverse_view.hpp
Normal file
14
include/boost/fusion/sequence/view/reverse_view.hpp
Normal file
@@ -0,0 +1,14 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_SEQUENCE_VIEW_REVERSE_VIEW_10022005_0612)
|
||||
#define FUSION_SEQUENCE_VIEW_REVERSE_VIEW_10022005_0612
|
||||
|
||||
#include <boost/fusion/sequence/view/reverse_view/reverse_view.hpp>
|
||||
#include <boost/fusion/sequence/view/reverse_view/reverse_view_iterator.hpp>
|
||||
|
||||
#endif
|
@@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
@@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,49 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
@@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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::ftag>::
|
||||
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
|
||||
|
||||
|
@@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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::ftag>::
|
||||
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
|
||||
|
||||
|
@@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,59 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/view/reverse_view/reverse_view_iterator.hpp>
|
||||
#include <boost/fusion/sequence/view/reverse_view/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/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_and_derived.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 ftag;
|
||||
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_and_derived<
|
||||
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
|
||||
|
||||
|
@@ -0,0 +1,49 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/view/reverse_view/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/reverse_view/detail/next_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/reverse_view/detail/prior_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/reverse_view/detail/advance_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/reverse_view/detail/distance_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/reverse_view/detail/value_of_impl.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.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 ftag;
|
||||
typedef typename traits::category_of<first_type>::type category;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
is_base_and_derived<
|
||||
bidirectional_traversal_tag
|
||||
, category>::value));
|
||||
|
||||
reverse_view_iterator(First const& first)
|
||||
: first(converter::call(first)) {}
|
||||
|
||||
first_type first;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
14
include/boost/fusion/sequence/view/single_view.hpp
Normal file
14
include/boost/fusion/sequence/view/single_view.hpp
Normal file
@@ -0,0 +1,14 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_SINGLE_VIEW_03192006_2216)
|
||||
#define FUSION_SINGLE_VIEW_03192006_2216
|
||||
|
||||
#include <boost/fusion/sequence/view/single_view/single_view.hpp>
|
||||
#include <boost/fusion/sequence/view/single_view/single_view_iterator.hpp>
|
||||
|
||||
#endif
|
@@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,35 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,55 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/view/single_view/single_view_iterator.hpp>
|
||||
#include <boost/fusion/sequence/view/single_view/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/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_sequence_tag;
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
template <typename T>
|
||||
struct single_view : sequence_base<single_view<T> >
|
||||
{
|
||||
typedef single_view_tag ftag;
|
||||
typedef fusion_sequence_tag tag; // this gets picked up by MPL
|
||||
typedef forward_sequence_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
|
||||
|
||||
|
@@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/view/single_view/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/single_view/detail/next_impl.hpp>
|
||||
#include <boost/fusion/sequence/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 ftag;
|
||||
typedef forward_traversal_tag category;
|
||||
};
|
||||
|
||||
template <typename SingleView>
|
||||
struct single_view_iterator
|
||||
: iterator_base<single_view_iterator<SingleView> >
|
||||
{
|
||||
typedef single_view_iterator_tag ftag;
|
||||
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
|
||||
|
||||
|
14
include/boost/fusion/sequence/view/transform_view.hpp
Normal file
14
include/boost/fusion/sequence/view/transform_view.hpp
Normal file
@@ -0,0 +1,14 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_SEQUENCE_VIEW_TRANSFORM_VIEW_10022005_0612)
|
||||
#define FUSION_SEQUENCE_VIEW_TRANSFORM_VIEW_10022005_0612
|
||||
|
||||
#include <boost/fusion/sequence/view/transform_view/transform_view.hpp>
|
||||
#include <boost/fusion/sequence/view/transform_view/transform_view_iterator.hpp>
|
||||
|
||||
#endif
|
@@ -0,0 +1,76 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
@@ -0,0 +1,37 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_APPLY_TRANSFORM_RESULT_02092006_1936)
|
||||
#define FUSION_APPLY_TRANSFORM_RESULT_02092006_1936
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct void_;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename F>
|
||||
struct apply_transform_result
|
||||
{
|
||||
template <typename T0, typename T1 = void_>
|
||||
struct apply
|
||||
{
|
||||
typedef typename F::template result<T0, T1>::type type;
|
||||
};
|
||||
|
||||
template <typename T0>
|
||||
struct apply<T0, void_>
|
||||
{
|
||||
typedef typename F::template result<T0>::type type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -0,0 +1,69 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_BEGIN_IMPL_07162005_1031)
|
||||
#define FUSION_BEGIN_IMPL_07162005_1031
|
||||
|
||||
#include <boost/fusion/sequence/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
|
||||
|
||||
|
@@ -0,0 +1,76 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/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::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;
|
||||
|
||||
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::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;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return i.f(*i.first1, *i.first2);
|
||||
}
|
||||
};
|
||||
}; }
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -0,0 +1,64 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
{
|
||||
typedef typename First::first_type first_type;
|
||||
typedef typename Last::first_type last_type;
|
||||
typedef typename result_of::distance<first_type, last_type>::type type;
|
||||
|
||||
static 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
|
||||
{
|
||||
typedef typename First::first1_type first1_type;
|
||||
typedef typename Last::first1_type last1_type;
|
||||
typedef typename result_of::distance<first1_type, last1_type>::type type;
|
||||
|
||||
static type
|
||||
call(First const& first, Last const& last)
|
||||
{
|
||||
return boost::fusion::distance(first.first1, last.first1);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@@ -0,0 +1,69 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_END_IMPL_07162005_1028)
|
||||
#define FUSION_END_IMPL_07162005_1028
|
||||
|
||||
#include <boost/fusion/sequence/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
|
||||
|
||||
|
@@ -0,0 +1,75 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,74 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
@@ -0,0 +1,64 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/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
|
||||
|
||||
|
@@ -0,0 +1,95 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/view/transform_view/transform_view_iterator.hpp>
|
||||
#include <boost/fusion/sequence/view/transform_view/transform_view_fwd.hpp>
|
||||
#include <boost/fusion/sequence/view/transform_view/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/transform_view/detail/end_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 ftag;
|
||||
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 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 ftag;
|
||||
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 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
|
||||
|
||||
|
@@ -0,0 +1,23 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
||||
|
||||
|
@@ -0,0 +1,68 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/sequence/view/transform_view/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/transform_view/detail/next_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/transform_view/detail/prior_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/transform_view/detail/value_of_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/transform_view/detail/advance_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/transform_view/detail/distance_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 ftag;
|
||||
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 ftag;
|
||||
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
|
||||
|
15
include/boost/fusion/sequence/view/zip_view.hpp
Normal file
15
include/boost/fusion/sequence/view/zip_view.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ZIP_VIEW_23012006_0811)
|
||||
#define FUSION_ZIP_VIEW_23012006_0811
|
||||
|
||||
#include <boost/fusion/sequence/view/zip_view/zip_view.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/zip_view_iterator.hpp>
|
||||
|
||||
#endif
|
@@ -0,0 +1,64 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ADVANCE_IMPL_20061024_2021)
|
||||
#define FUSION_ADVANCE_IMPL_20061024_2021
|
||||
|
||||
#include <boost/fusion/sequence/view/zip_view/zip_view_iterator_fwd.hpp>
|
||||
#include <boost/fusion/iterator/advance.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct zip_view_iterator_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<typename N>
|
||||
struct poly_advance
|
||||
{
|
||||
template<typename It>
|
||||
struct result
|
||||
: result_of::advance<It,N>
|
||||
{};
|
||||
|
||||
template<typename It>
|
||||
typename result<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
|
@@ -0,0 +1,78 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_AT_IMPL_20060124_1933)
|
||||
#define FUSION_AT_IMPL_20060124_1933
|
||||
|
||||
#include <boost/fusion/sequence/container/vector.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/fusion/sequence/conversion/as_vector.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>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct zip_view_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<typename N>
|
||||
struct poly_at
|
||||
{
|
||||
template<typename SeqRef>
|
||||
struct result
|
||||
: result_of::at<typename remove_reference<SeqRef>::type, N>
|
||||
{
|
||||
BOOST_MPL_ASSERT((is_reference<SeqRef>));
|
||||
};
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq&>::type
|
||||
operator()(Seq& seq) const
|
||||
{
|
||||
return fusion::at<N>(seq);
|
||||
}
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq const&>::type
|
||||
operator()(Seq const& seq) const
|
||||
{
|
||||
return fusion::at<N>(seq);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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
|
@@ -0,0 +1,80 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_BEGIN_IMPL_20060123_2147)
|
||||
#define FUSION_BEGIN_IMPL_20060123_2147
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/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/mpl/assert.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct zip_view_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct poly_begin
|
||||
{
|
||||
template<typename SeqRef>
|
||||
struct result
|
||||
: result_of::begin<typename remove_reference<SeqRef>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT((is_reference<SeqRef>));
|
||||
};
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq&>::type
|
||||
operator()(Seq& seq) const
|
||||
{
|
||||
return fusion::begin(seq);
|
||||
}
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq const&>::type
|
||||
operator()(Seq const& seq) const
|
||||
{
|
||||
return fusion::begin(seq);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
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
|
@@ -0,0 +1,64 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_DEREF_IMPL_20061024_1959)
|
||||
#define FUSION_DEREF_IMPL_20061024_1959
|
||||
|
||||
#include <boost/fusion/sequence/container/vector.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||
#include <boost/fusion/sequence/conversion/as_vector.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct zip_view_iterator_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct poly_deref
|
||||
{
|
||||
template<typename It>
|
||||
struct result
|
||||
: result_of::deref<It>
|
||||
{};
|
||||
|
||||
template<typename It>
|
||||
typename result<It>::type
|
||||
operator()(const It& it) const
|
||||
{
|
||||
return fusion::deref(it);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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
|
@@ -0,0 +1,83 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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
|
@@ -0,0 +1,80 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_END_IMPL_20060123_2208)
|
||||
#define FUSION_END_IMPL_20060123_2208
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/sequence/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/mpl/assert.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct zip_view_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct poly_end
|
||||
{
|
||||
template<typename SeqRef>
|
||||
struct result
|
||||
: result_of::end<typename remove_reference<SeqRef>::type>
|
||||
{
|
||||
BOOST_MPL_ASSERT((is_reference<SeqRef>));
|
||||
};
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq&>::type
|
||||
operator()(Seq& seq) const
|
||||
{
|
||||
return fusion::end(seq);
|
||||
}
|
||||
|
||||
template<typename Seq>
|
||||
typename result<Seq const&>::type
|
||||
operator()(Seq const& seq) const
|
||||
{
|
||||
return fusion::end(seq);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
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::poly_end>::type,
|
||||
typename Sequence::category> type;
|
||||
|
||||
static type
|
||||
call(Sequence& sequence)
|
||||
{
|
||||
return type(
|
||||
fusion::transform(sequence.sequences_, detail::poly_end()));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@@ -0,0 +1,63 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_EQUAL_TO_IMPL_20060128_1423)
|
||||
#define FUSION_EQUAL_TO_IMPL_20060128_1423
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/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
|
@@ -0,0 +1,64 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_NEXT_IMPL_20060124_2006)
|
||||
#define FUSION_NEXT_IMPL_20060124_2006
|
||||
|
||||
#include <boost/fusion/sequence/view/zip_view/zip_view_iterator_fwd.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct zip_view_iterator_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct poly_next
|
||||
{
|
||||
template<typename It>
|
||||
struct result
|
||||
: result_of::next<It>
|
||||
{};
|
||||
|
||||
template<typename It>
|
||||
typename result<It>::type
|
||||
operator()(const It& it) const
|
||||
{
|
||||
return fusion::next(it);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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
|
@@ -0,0 +1,65 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_PRIOR_IMPL_20060124_2006)
|
||||
#define FUSION_PRIOR_IMPL_20060124_2006
|
||||
|
||||
#include <boost/fusion/sequence/view/zip_view/zip_view_iterator_fwd.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct zip_view_iterator_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct poly_prior
|
||||
{
|
||||
template<typename It>
|
||||
struct result
|
||||
: result_of::prior<It>
|
||||
{};
|
||||
|
||||
template<typename It>
|
||||
typename result<It>::type
|
||||
operator()(const It& it) const
|
||||
{
|
||||
return fusion::prior(it);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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
|
@@ -0,0 +1,64 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_SIZE_IMPL_20060124_0800)
|
||||
#define FUSION_SIZE_IMPL_20060124_0800
|
||||
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
#include <boost/fusion/algorithm/query/find_if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct zip_view_tag;
|
||||
struct random_access_iterator_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct zip_view_size
|
||||
{
|
||||
typedef result_of::find_if<
|
||||
typename Sequence::sequences,
|
||||
is_same<traits::category_of<remove_reference<mpl::_> >, random_access_iterator_tag> > finder;
|
||||
|
||||
typedef typename remove_reference<typename mpl::eval_if<
|
||||
result_of::equal_to<typename finder::type, typename result_of::end<typename Sequence::sequences>::type>,
|
||||
result_of::value_at_c<typename Sequence::sequences, 0>,
|
||||
result_of::deref<typename finder::type> >::type>::type best_sequence;
|
||||
|
||||
typedef typename fusion::result_of::size<best_sequence> type;
|
||||
};
|
||||
}
|
||||
|
||||
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
|
||||
: detail::zip_view_size<Sequence>::type
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@@ -0,0 +1,64 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#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/mpl/placeholders.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/mpl.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct forward_traversal_tag;
|
||||
struct bidirectional_traversal_tag;
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<typename Next, typename StrictestSoFar>
|
||||
struct strictest_traversal_impl
|
||||
{
|
||||
typedef StrictestSoFar tag1;
|
||||
typedef typename traits::category_of<
|
||||
typename remove_reference<Next>::type>::type tag2;
|
||||
|
||||
typedef typename mpl::or_<
|
||||
is_same<tag1, fusion::forward_traversal_tag>,
|
||||
is_same<tag2, fusion::forward_traversal_tag> >::type
|
||||
has_forward_traversal;
|
||||
|
||||
typedef typename mpl::or_<
|
||||
is_same<tag1, fusion::bidirectional_traversal_tag>,
|
||||
is_same<tag2, fusion::bidirectional_traversal_tag> >::type
|
||||
has_bidirectional_traversal;
|
||||
|
||||
typedef typename mpl::if_<
|
||||
has_forward_traversal,
|
||||
forward_traversal_tag,
|
||||
typename mpl::if_<
|
||||
has_bidirectional_traversal,
|
||||
bidirectional_traversal_tag,
|
||||
random_access_traversal_tag>::type>::type type;
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
struct strictest_traversal
|
||||
: result_of::fold<
|
||||
Sequence, fusion::random_access_traversal_tag,
|
||||
strictest_traversal_impl<boost::mpl::_,boost::mpl::_> >
|
||||
{};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@@ -0,0 +1,53 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_VALUE_AT_IMPL_20060124_2129)
|
||||
#define FUSION_VALUE_AT_IMPL_20060124_2129
|
||||
|
||||
#include <boost/fusion/sequence/conversion/as_vector.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct zip_view_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<typename N>
|
||||
struct poly_value_at
|
||||
{
|
||||
template<typename Seq>
|
||||
struct result
|
||||
: 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
|
@@ -0,0 +1,53 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_VALUE_OF_IMPL_20060124_2147)
|
||||
#define FUSION_VALUE_OF_IMPL_20060124_2147
|
||||
|
||||
#include <boost/fusion/sequence/conversion/as_vector.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct zip_view_iterator_tag;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct poly_value_of
|
||||
{
|
||||
template<typename It>
|
||||
struct result
|
||||
: 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
|
88
include/boost/fusion/sequence/view/zip_view/zip_view.hpp
Normal file
88
include/boost/fusion/sequence/view/zip_view/zip_view.hpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ZIP_VIEW_23012006_0813)
|
||||
#define FUSION_ZIP_VIEW_23012006_0813
|
||||
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/end_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/size_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/at_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/sequence/conversion/as_vector.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/sequence/intrinsic/mpl.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/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>
|
||||
{};
|
||||
|
||||
template<typename Sequences>
|
||||
struct all_same_size_impl
|
||||
{
|
||||
typedef mpl::transform_view<Sequences, fusion::result_of::size<remove_reference<mpl::_> > > sizes;
|
||||
typedef typename mpl::at_c<sizes, 0>::type first_size;
|
||||
typedef mpl::iterator_range<
|
||||
typename mpl::next<typename mpl::begin<sizes>::type>::type,
|
||||
typename mpl::end<sizes>::type> remainder;
|
||||
typedef typename mpl::find_if<remainder, mpl::not_<is_same<mpl::_, first_size> > >::type found_difference;
|
||||
typedef typename is_same<found_difference, typename mpl::end<remainder>::type>::type type;
|
||||
};
|
||||
|
||||
template<typename Sequences>
|
||||
struct all_same_size
|
||||
: all_same_size_impl<Sequences>::type
|
||||
{};
|
||||
}
|
||||
|
||||
struct zip_view_tag;
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
template<typename Sequences>
|
||||
struct zip_view : sequence_base< zip_view<Sequences> >
|
||||
{
|
||||
BOOST_MPL_ASSERT((detail::all_references<Sequences>));
|
||||
BOOST_MPL_ASSERT((detail::all_same_size<Sequences>));
|
||||
typedef typename detail::strictest_traversal<Sequences>::type category;
|
||||
typedef zip_view_tag ftag;
|
||||
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;
|
||||
|
||||
zip_view(
|
||||
const Sequences& seqs)
|
||||
: sequences_(seqs)
|
||||
{};
|
||||
|
||||
sequences sequences_;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
@@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ZIP_VIEW_ITERATOR_23012006_0814)
|
||||
#define FUSION_ZIP_VIEW_ITERATOR_23012006_0814
|
||||
|
||||
#include <boost/fusion/sequence/view/zip_view/zip_view_iterator_fwd.hpp>
|
||||
#include <boost/fusion/support/iterator_base.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/next_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/prior_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/advance_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/distance_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/value_of_impl.hpp>
|
||||
#include <boost/fusion/sequence/view/zip_view/detail/equal_to_impl.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/conversion/as_vector.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 ftag;
|
||||
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
|
@@ -0,0 +1,23 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ZIP_VIEW_ITERATOR_FWD)
|
||||
#define FUSION_ZIP_VIEW_ITERATOR_FWD
|
||||
|
||||
#include <boost/fusion/sequence/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
|
Reference in New Issue
Block a user