]> git.sesse.net Git - casparcg/blob - dependencies/boost/boost/fusion/view/transform_view/detail/advance_impl.hpp
Manually merged pull request #222
[casparcg] / dependencies / boost / boost / fusion / view / transform_view / detail / advance_impl.hpp
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_ADVANCE_IMPL_13122005_1906)
9 #define FUSION_ADVANCE_IMPL_13122005_1906
10
11 #include <boost/fusion/iterator/advance.hpp>
12
13 namespace boost { namespace fusion 
14 {
15     struct transform_view_iterator_tag;
16     struct transform_view_iterator2_tag;
17
18     template<typename First, typename F>
19     struct transform_view_iterator;
20
21     template <typename First1, typename First2, typename F>
22     struct transform_view_iterator2;
23
24     namespace extension
25     {
26         template<typename Tag>
27         struct advance_impl;
28
29         // Unary Version
30         template<>
31         struct advance_impl<transform_view_iterator_tag>
32         {
33             template<typename Iterator, typename Dist>
34             struct apply
35             {
36                 typedef typename Iterator::first_type first_type;
37                 typedef typename result_of::advance<first_type, Dist>::type advanced_type;
38                 typedef typename Iterator::transform_type transform_type;
39                 typedef transform_view_iterator<advanced_type, transform_type> type;
40
41                 static type
42                 call(Iterator const& i)
43                 {
44                     return type(boost::fusion::advance<Dist>(i.first), i.f);
45                 }
46             };
47         };
48
49         // Binary Version
50         template<>
51         struct advance_impl<transform_view_iterator2_tag>
52         {
53             template<typename Iterator, typename Dist>
54             struct apply
55             {
56                 typedef typename Iterator::first1_type first1_type;
57                 typedef typename Iterator::first2_type first2_type;
58                 typedef typename result_of::advance<first1_type, Dist>::type advanced1_type;
59                 typedef typename result_of::advance<first2_type, Dist>::type advanced2_type;
60                 typedef typename Iterator::transform_type transform_type;
61                 typedef transform_view_iterator2<advanced1_type, advanced2_type, transform_type> type;
62
63                 static type
64                 call(Iterator const& i)
65                 {
66                     return type(
67                         boost::fusion::advance<Dist>(i.first1)
68                       , boost::fusion::advance<Dist>(i.first2), i.f);
69                 }
70             };
71         };
72     }
73 }}
74
75 #endif