1 /*============================================================================= 2 Copyright (c) 2009 Hartmut Kaiser 3 4 Distributed under the Boost Software License, Version 1.0. (See accompanying 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 ==============================================================================*/ 7 8 #if !defined(BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM) 9 #define BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM 10 11 #include <boost/fusion/support/config.hpp> 12 #include <boost/fusion/iterator/value_of.hpp> 13 #include <boost/fusion/sequence/intrinsic/at.hpp> 14 15 namespace boost { namespace fusion 16 { 17 struct nview_iterator_tag; 18 19 namespace extension 20 { 21 template<typename Tag> 22 struct deref_impl; 23 24 template<> 25 struct deref_impl<nview_iterator_tag> 26 { 27 template<typename Iterator> 28 struct apply 29 { 30 typedef typename Iterator::first_type first_type; 31 typedef typename Iterator::sequence_type sequence_type; 32 33 typedef typename result_of::value_of<first_type>::type index; 34 typedef typename result_of::at< 35 typename sequence_type::sequence_type, index>::type type; 36 37 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED callboost::fusion::extension::deref_impl::apply38 static type call(Iterator const& i) 39 { 40 return at<index>(i.seq.seq); 41 } 42 }; 43 }; 44 45 } 46 47 }} 48 49 #endif 50 51