1 /*============================================================================= 2 Copyright (c) 2003 Joel de Guzman 3 Copyright (c) 2004 Peder Holt 4 5 Use, modification and distribution is subject to the Boost Software 6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 http://www.boost.org/LICENSE_1_0.txt) 8 ==============================================================================*/ 9 #if !defined(FUSION_ITERATOR_DETAIL_TRANSFORM_VIEW_ITERATOR_DEREF_TRAITS_HPP) 10 #define FUSION_ITERATOR_DETAIL_TRANSFORM_VIEW_ITERATOR_DEREF_TRAITS_HPP 11 12 #include <boost/spirit/fusion/detail/config.hpp> 13 #include <boost/spirit/fusion/iterator/deref.hpp> 14 #include <boost/spirit/fusion/iterator/value_of.hpp> 15 16 namespace boost { namespace fusion 17 { 18 struct transform_view_iterator_tag; 19 20 namespace transform_view_detail { 21 template<typename Iterator> 22 struct deref_traits_impl { 23 typedef typename 24 meta::value_of<typename Iterator::first_type>::type 25 value_type; 26 27 typedef typename Iterator::transform_type transform_type; 28 typedef typename fusion_apply1<transform_type, value_type>::type type; 29 30 static type 31 call(Iterator const& i); 32 }; 33 34 template<typename Iterator> 35 BOOST_DEDUCED_TYPENAME deref_traits_impl<Iterator>::type call(Iterator const & i)36 deref_traits_impl<Iterator>::call(Iterator const& i) 37 { 38 return i.f(*i.first); 39 } 40 } 41 42 namespace meta 43 { 44 template <typename Tag> 45 struct deref_impl; 46 47 template <> 48 struct deref_impl<transform_view_iterator_tag> 49 { 50 template <typename Iterator> 51 struct apply : transform_view_detail::deref_traits_impl<Iterator> 52 {}; 53 }; 54 } 55 }} 56 57 #endif 58 59 60