Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / fusion / view / transform_view / detail / begin_impl.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3
4     Distributed under the Boost Software License, Version 1.0. (See accompanying 
5     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #if !defined(FUSION_BEGIN_IMPL_07162005_1031)
8 #define FUSION_BEGIN_IMPL_07162005_1031
9
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/fusion/view/transform_view/transform_view_fwd.hpp>
12
13 namespace boost { namespace fusion
14 {
15     template <typename First, typename F>
16     struct transform_view_iterator;
17
18     template <typename First1, typename First2, typename F>
19     struct transform_view_iterator2;
20
21     namespace extension
22     {
23         template <typename Tag>
24         struct begin_impl;
25
26         // Unary Version
27         template <>
28         struct begin_impl<transform_view_tag>
29         {
30             template <typename Sequence>
31             struct apply
32             {
33                 typedef typename Sequence::first_type first_type;
34                 typedef typename Sequence::transform_type transform_type;
35                 typedef transform_view_iterator<first_type, transform_type> type;
36
37                 BOOST_FUSION_GPU_ENABLED
38                 static type
39                 call(Sequence& s)
40                 {
41                     return type(s.first(), s.f);
42                 }
43             };
44         };
45
46         // Binary Version
47         template <>
48         struct begin_impl<transform_view2_tag>
49         {
50             template <typename Sequence>
51             struct apply
52             {
53                 typedef typename Sequence::first1_type first1_type;
54                 typedef typename Sequence::first2_type first2_type;
55                 typedef typename Sequence::transform_type transform_type;
56                 typedef transform_view_iterator2<first1_type, first2_type, transform_type> type;
57
58                 BOOST_FUSION_GPU_ENABLED
59                 static type
60                 call(Sequence& s)
61                 {
62                     return type(s.first1(), s.first2(), s.f);
63                 }
64             };
65         };
66     }
67 }}
68
69 #endif
70
71