| /*============================================================================= |
| Copyright (c) 2001-2006 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_ADVANCE_IMPL_20061024_2021) |
| #define FUSION_ADVANCE_IMPL_20061024_2021 |
| |
| #include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp> |
| #include <boost/fusion/iterator/advance.hpp> |
| #include <boost/fusion/algorithm/transformation/transform.hpp> |
| #include <boost/type_traits/remove_reference.hpp> |
| |
| namespace boost { namespace fusion { |
| |
| struct zip_view_iterator_tag; |
| |
| namespace detail |
| { |
| template<typename N> |
| struct poly_advance |
| { |
| template<typename Sig> |
| struct result; |
| |
| template<typename N1, typename It> |
| struct result<poly_advance<N1>(It)> |
| { |
| typedef typename remove_reference<It>::type it; |
| typedef typename result_of::advance<it,N>::type type; |
| }; |
| |
| template<typename It> |
| typename result<poly_advance(It)>::type |
| operator()(const It& it) const |
| { |
| return fusion::advance<N>(it); |
| } |
| }; |
| } |
| |
| namespace extension |
| { |
| template<typename Tag> |
| struct advance_impl; |
| |
| template<> |
| struct advance_impl<zip_view_iterator_tag> |
| { |
| template<typename It, typename N> |
| struct apply |
| { |
| typedef zip_view_iterator< |
| typename result_of::transform<typename It::iterators, detail::poly_advance<N> >::type> type; |
| |
| static type |
| call(It const& it) |
| { |
| return type( |
| fusion::transform(it.iterators_, detail::poly_advance<N>())); |
| } |
| }; |
| }; |
| } |
| }} |
| |
| #endif |