| 1 | /*============================================================================= |
|---|---|
| 2 | Copyright (c) 2001-2011 Joel de Guzman |
| 3 | Copyright (c) 2018 Kohei Takahashi |
| 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_07162005_1030) |
| 9 | #define FUSION_VALUE_OF_IMPL_07162005_1030 |
| 10 | |
| 11 | #include <boost/fusion/support/config.hpp> |
| 12 | #include <boost/fusion/iterator/value_of.hpp> |
| 13 | #include <boost/utility/result_of.hpp> |
| 14 | |
| 15 | namespace boost { namespace fusion |
| 16 | { |
| 17 | struct transform_view_iterator_tag; |
| 18 | struct transform_view_iterator2_tag; |
| 19 | |
| 20 | namespace extension |
| 21 | { |
| 22 | template <typename Tag> |
| 23 | struct value_of_impl; |
| 24 | |
| 25 | // Unary Version |
| 26 | template <> |
| 27 | struct value_of_impl<transform_view_iterator_tag> |
| 28 | { |
| 29 | template <typename Iterator> |
| 30 | struct apply |
| 31 | { |
| 32 | typedef typename |
| 33 | result_of::value_of<typename Iterator::first_type>::type |
| 34 | value_type; |
| 35 | |
| 36 | typedef typename Iterator::transform_type F; |
| 37 | typedef typename boost::result_of<F(value_type)>::type type; |
| 38 | }; |
| 39 | }; |
| 40 | |
| 41 | // Binary Version |
| 42 | template <> |
| 43 | struct value_of_impl<transform_view_iterator2_tag> |
| 44 | { |
| 45 | template <typename Iterator> |
| 46 | struct apply |
| 47 | { |
| 48 | typedef typename |
| 49 | result_of::value_of<typename Iterator::first1_type>::type |
| 50 | value1_type; |
| 51 | typedef typename |
| 52 | result_of::value_of<typename Iterator::first2_type>::type |
| 53 | value2_type; |
| 54 | |
| 55 | typedef typename Iterator::transform_type F; |
| 56 | typedef typename boost::result_of<F(value1_type, value2_type)>::type type; |
| 57 | }; |
| 58 | }; |
| 59 | } |
| 60 | }} |
| 61 | |
| 62 | #endif |
| 63 | |
| 64 | |
| 65 |