Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:41:56

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003     Copyright (c) 2006 Dan Marsden
0004 
0005     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0006     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 ==============================================================================*/
0008 #if !defined(FUSION_DEREF_IMPL_20061024_1959)
0009 #define FUSION_DEREF_IMPL_20061024_1959
0010 
0011 #include <boost/fusion/support/config.hpp>
0012 #include <boost/fusion/container/vector.hpp>
0013 #include <boost/fusion/iterator/deref.hpp>
0014 #include <boost/fusion/algorithm/transformation/transform.hpp>
0015 #include <boost/fusion/container/vector/convert.hpp>
0016 #include <boost/fusion/support/unused.hpp>
0017 #include <boost/mpl/eval_if.hpp>
0018 #include <boost/mpl/identity.hpp>
0019 #include <boost/type_traits/is_same.hpp>
0020 #include <boost/type_traits/remove_reference.hpp>
0021 #include <boost/type_traits/remove_const.hpp>
0022 
0023 namespace boost { namespace fusion {
0024 
0025     struct zip_view_iterator_tag;
0026 
0027     namespace detail
0028     {
0029         struct poly_deref
0030         {
0031             template<typename Sig>
0032             struct result;
0033 
0034             template<typename It>
0035             struct result<poly_deref(It)>
0036             {
0037                 typedef typename remove_const<
0038                     typename remove_reference<It>::type>::type it;
0039 
0040                 typedef typename mpl::eval_if<is_same<it, unused_type>,
0041                     mpl::identity<unused_type>,
0042                     result_of::deref<it> >::type type;
0043             };
0044 
0045             template<typename It>
0046             BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0047             typename result<poly_deref(It)>::type
0048             operator()(const It& it) const
0049             {
0050                 return fusion::deref(it);
0051             }
0052 
0053             BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0054             unused_type operator()(unused_type const&) const
0055             {
0056                 return unused_type();
0057             }
0058         };
0059     }
0060 
0061     namespace extension
0062     {
0063         template<typename Tag>
0064         struct deref_impl;
0065 
0066         template<>
0067         struct deref_impl<zip_view_iterator_tag>
0068         {
0069             template<typename It>
0070             struct apply
0071             {
0072                 typedef typename result_of::as_vector<
0073                     typename result_of::transform<typename It::iterators, detail::poly_deref>::type>::type type;
0074 
0075                 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0076                 static type
0077                 call(It const& it)
0078                 {
0079                     return type(
0080                         fusion::transform(it.iterators_, detail::poly_deref()));
0081                 }
0082             };
0083         };
0084     }
0085 }}
0086 
0087 #endif