File indexing completed on 2025-01-31 09:41:56
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(FUSION_PRIOR_IMPL_20060124_2006)
0009 #define FUSION_PRIOR_IMPL_20060124_2006
0010
0011 #include <boost/fusion/support/config.hpp>
0012 #include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
0013 #include <boost/fusion/iterator/prior.hpp>
0014 #include <boost/fusion/algorithm/transformation/transform.hpp>
0015 #include <boost/fusion/support/unused.hpp>
0016 #include <boost/mpl/eval_if.hpp>
0017 #include <boost/mpl/identity.hpp>
0018 #include <boost/type_traits/is_same.hpp>
0019 #include <boost/type_traits/remove_reference.hpp>
0020 #include <boost/type_traits/remove_const.hpp>
0021
0022 namespace boost { namespace fusion {
0023
0024 struct zip_view_iterator_tag;
0025
0026 namespace detail
0027 {
0028 struct poly_prior
0029 {
0030 template<typename Sig>
0031 struct result;
0032
0033 template<typename It>
0034 struct result<poly_prior(It)>
0035 {
0036 typedef typename remove_const<
0037 typename remove_reference<It>::type>::type it;
0038 typedef typename mpl::eval_if<is_same<it, unused_type>,
0039 mpl::identity<unused_type>,
0040 result_of::prior<it> >::type type;
0041 };
0042
0043 template<typename It>
0044 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0045 typename result<poly_prior(It)>::type
0046 operator()(const It& it) const
0047 {
0048 return fusion::prior(it);
0049 }
0050
0051 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0052 unused_type operator()(unused_type const&) const
0053 {
0054 return unused_type();
0055 }
0056 };
0057 }
0058
0059 namespace extension
0060 {
0061 template<typename Tag>
0062 struct prior_impl;
0063
0064 template<>
0065 struct prior_impl<zip_view_iterator_tag>
0066 {
0067 template<typename Iterator>
0068 struct apply
0069 {
0070 typedef zip_view_iterator<
0071 typename result_of::transform<typename Iterator::iterators, detail::poly_prior>::type,
0072 typename Iterator::category> type;
0073
0074 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0075 static type
0076 call(Iterator const& it)
0077
0078 {
0079 return type(
0080 fusion::transform(it.iterators_, detail::poly_prior()));
0081 }
0082 };
0083 };
0084 }
0085 }}
0086
0087 #endif