1 /*============================================================================= 2 Copyright (c) 2001-2011 Joel de Guzman 3 Copyright (c) 2006 Dan Marsden 4 5 Distributed under the Boost Software License, Version 1.0. (See accompanying 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 ==============================================================================*/ 8 #if !defined(FUSION_VALUE_OF_IMPL_20060124_2147) 9 #define FUSION_VALUE_OF_IMPL_20060124_2147 10 11 #include <boost/fusion/support/config.hpp> 12 #include <boost/fusion/container/vector/convert.hpp> 13 #include <boost/fusion/algorithm/transformation/transform.hpp> 14 #include <boost/fusion/iterator/value_of.hpp> 15 #include <boost/mpl/placeholders.hpp> 16 #include <boost/fusion/support/unused.hpp> 17 #include <boost/mpl/eval_if.hpp> 18 #include <boost/mpl/identity.hpp> 19 #include <boost/type_traits/is_same.hpp> 20 #include <boost/config.hpp> 21 22 namespace boost { namespace fusion 23 { 24 struct zip_view_iterator_tag; 25 26 namespace detail 27 { 28 struct poly_value_of 29 { 30 template<typename T> 31 struct result; 32 33 template<typename It> 34 struct result<poly_value_of(It)> 35 : mpl::eval_if<is_same<It, unused_type>, 36 mpl::identity<unused_type>, 37 result_of::value_of<It> > 38 {}; 39 40 // never called, but needed for decltype-based result_of (C++0x) 41 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES 42 template<typename It> 43 BOOST_FUSION_GPU_ENABLED 44 typename result<poly_value_of(It)>::type 45 operator()(It&&) const; 46 #endif 47 }; 48 } 49 50 namespace extension 51 { 52 template<typename Tag> 53 struct value_of_impl; 54 55 template<> 56 struct value_of_impl<zip_view_iterator_tag> 57 { 58 template<typename Iterator> 59 struct apply 60 { 61 typedef typename result_of::transform< 62 typename Iterator::iterators, 63 detail::poly_value_of>::type values; 64 65 typedef typename result_of::as_vector<values>::type type; 66 }; 67 }; 68 } 69 }} 70 71 #endif 72