| 1 | /*============================================================================= |
| 2 | Copyright (c) 2001-2011 Joel de Guzman |
| 3 | Copyright (c) 2005-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_DISTANCE_IMPL_13122005_2139) |
| 9 | #define FUSION_DISTANCE_IMPL_13122005_2139 |
| 10 | |
| 11 | #include <boost/fusion/support/config.hpp> |
| 12 | #include <boost/fusion/iterator/distance.hpp> |
| 13 | |
| 14 | namespace boost { namespace fusion { |
| 15 | |
| 16 | struct transform_view_iterator_tag; |
| 17 | struct transform_view_iterator2_tag; |
| 18 | |
| 19 | namespace extension |
| 20 | { |
| 21 | template<typename Tag> |
| 22 | struct distance_impl; |
| 23 | |
| 24 | // Unary Version |
| 25 | template<> |
| 26 | struct distance_impl<transform_view_iterator_tag> |
| 27 | { |
| 28 | template<typename First, typename Last> |
| 29 | struct apply |
| 30 | : result_of::distance<typename First::first_type, typename Last::first_type> |
| 31 | { |
| 32 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 33 | static |
| 34 | typename result_of::distance<typename First::first_type, typename Last::first_type>::type |
| 35 | call(First const& first, Last const& last) |
| 36 | { |
| 37 | return boost::fusion::distance(first.first, last.first); |
| 38 | } |
| 39 | }; |
| 40 | }; |
| 41 | |
| 42 | // Binary Version |
| 43 | template<> |
| 44 | struct distance_impl<transform_view_iterator2_tag> |
| 45 | { |
| 46 | template<typename First, typename Last> |
| 47 | struct apply |
| 48 | : result_of::distance<typename First::first1_type, typename Last::first1_type> |
| 49 | { |
| 50 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 51 | static |
| 52 | typename result_of::distance<typename First::first1_type, typename Last::first1_type>::type |
| 53 | call(First const& first, Last const& last) |
| 54 | { |
| 55 | return boost::fusion::distance(first.first1, last.first1); |
| 56 | } |
| 57 | }; |
| 58 | }; |
| 59 | } |
| 60 | }} |
| 61 | |
| 62 | #endif |
| 63 | |