/*============================================================================= Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2006 Dan Marsden Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_DISTANCE_IMPL_20060124_2033) #define FUSION_DISTANCE_IMPL_20060124_2033 #include #include #include #include #include #include #include #include #include #include namespace boost { namespace fusion { struct zip_view_iterator_tag; struct random_access_iterator_tag; namespace detail { template struct best_distance { typedef typename result_of::find_if< typename SearchIt::iterators, is_same, random_access_iterator_tag> > finder; BOOST_MPL_ASSERT_NOT((is_same >)); typedef typename result_of::distance::type type; }; template struct default_distance : result_of::distance< typename result_of::value_at_c::type, typename result_of::value_at_c::type> {}; template struct zip_view_iterator_distance { typedef typename result_of::find_if< typename It1::iterators, is_same, random_access_iterator_tag> > finder; typedef typename mpl::eval_if< is_same::type>, detail::default_distance , detail::best_distance >::type type; }; } namespace extension { template struct distance_impl; template<> struct distance_impl { template struct apply : detail::zip_view_iterator_distance::type { BOOST_FUSION_GPU_ENABLED static typename detail::zip_view_iterator_distance::type call(It1 const& /*it1*/, It2 const& /*it2*/) { return typename detail::zip_view_iterator_distance::type(); } }; }; } }} #endif