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_AT_IMPL_20060124_1933)
0009 #define FUSION_AT_IMPL_20060124_1933
0010 
0011 #include <boost/fusion/support/config.hpp>
0012 #include <boost/fusion/container/vector.hpp>
0013 #include <boost/fusion/sequence/intrinsic/at.hpp>
0014 #include <boost/fusion/container/vector/convert.hpp>
0015 #include <boost/fusion/algorithm/transformation/transform.hpp>
0016 #include <boost/type_traits/remove_reference.hpp>
0017 #include <boost/type_traits/is_reference.hpp>
0018 #include <boost/mpl/assert.hpp>
0019 #include <boost/fusion/support/unused.hpp>
0020 #include <boost/mpl/eval_if.hpp>
0021 #include <boost/mpl/identity.hpp>
0022 #include <boost/type_traits/is_same.hpp>
0023 
0024 
0025 namespace boost { namespace fusion 
0026 {
0027     struct zip_view_tag;
0028 
0029     namespace detail
0030     {
0031         template<typename N>
0032         struct poly_at
0033         {
0034             template<typename T>
0035             struct result;
0036 
0037             template<typename N1, typename SeqRef>
0038             struct result<poly_at<N1>(SeqRef)>
0039                 : mpl::eval_if<is_same<SeqRef, unused_type const&>,
0040                                mpl::identity<unused_type>,
0041                                result_of::at<typename remove_reference<SeqRef>::type, N> >
0042             {
0043                 BOOST_MPL_ASSERT((is_reference<SeqRef>));
0044             };
0045 
0046             template<typename Seq>
0047             BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0048             typename result<poly_at(Seq&)>::type
0049             operator()(Seq& seq) const
0050             {
0051                 return fusion::at<N>(seq);
0052             }
0053 
0054             template<typename Seq>
0055             BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0056             typename result<poly_at(Seq const&)>::type
0057             operator()(Seq const& seq) const
0058             {
0059                 return fusion::at<N>(seq);
0060             }
0061 
0062             BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0063             unused_type operator()(unused_type const&) const
0064             {
0065                 return unused_type();
0066             }
0067         };
0068     }
0069 
0070     namespace extension
0071     {
0072         template<typename Tag>
0073         struct at_impl;
0074 
0075         template<>
0076         struct at_impl<zip_view_tag>
0077         {
0078             template<typename Seq, typename N>
0079             struct apply
0080             {
0081                 typedef typename result_of::as_vector<
0082                     typename result_of::transform<
0083                     typename Seq::sequences, detail::poly_at<N> >::type>::type type;
0084 
0085                 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0086                 static type
0087                 call(Seq& seq)
0088                 {
0089                     return type(
0090                         fusion::transform(seq.sequences_, detail::poly_at<N>()));
0091                 }
0092             };
0093         };
0094     }
0095 }}
0096 
0097 #endif