Release 1.39.0
[boost.git] / Boost_1_39_0 / boost / fusion / view / transform_view / transform_view_iterator.hpp
blobbb4b6afdb47708190048ef7d7fcb40c61a6e75da
1 /*=============================================================================
2 Copyright (c) 2001-2006 Joel de Guzman
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_TRANSFORM_VIEW_ITERATOR_07162005_1033)
8 #define FUSION_TRANSFORM_VIEW_ITERATOR_07162005_1033
10 #include <boost/fusion/support/iterator_base.hpp>
11 #include <boost/fusion/support/category_of.hpp>
12 #include <boost/fusion/iterator/mpl/convert_iterator.hpp>
13 #include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
14 #include <boost/fusion/view/transform_view/detail/deref_impl.hpp>
15 #include <boost/fusion/view/transform_view/detail/next_impl.hpp>
16 #include <boost/fusion/view/transform_view/detail/prior_impl.hpp>
17 #include <boost/fusion/view/transform_view/detail/value_of_impl.hpp>
18 #include <boost/fusion/view/transform_view/detail/advance_impl.hpp>
19 #include <boost/fusion/view/transform_view/detail/distance_impl.hpp>
20 #include <boost/fusion/view/transform_view/detail/equal_to_impl.hpp>
22 namespace boost { namespace fusion
24 // Unary Version
25 struct transform_view_iterator_tag;
27 template <typename First, typename F>
28 struct transform_view_iterator
29 : iterator_base<transform_view_iterator<First, F> >
31 typedef transform_view_iterator_tag fusion_tag;
32 typedef convert_iterator<First> converter;
33 typedef typename converter::type first_type;
34 typedef typename traits::category_of<first_type>::type category;
35 typedef F transform_type;
37 transform_view_iterator(First const& first, F const& f)
38 : first(converter::call(first)), f(f) {}
40 first_type first;
41 transform_type f;
44 // Binary Version
45 struct transform_view_iterator2_tag;
47 template <typename First1, typename First2, typename F>
48 struct transform_view_iterator2
49 : iterator_base<transform_view_iterator2<First1, First2, F> >
51 typedef transform_view_iterator2_tag fusion_tag;
52 typedef convert_iterator<First1> converter1;
53 typedef convert_iterator<First2> converter2;
54 typedef typename converter1::type first1_type;
55 typedef typename converter2::type first2_type;
56 typedef typename traits::category_of<first1_type>::type category;
57 typedef F transform_type;
59 transform_view_iterator2(First1 const& first1, First2 const& first2, F const& f)
60 : first1(converter1::call(first1)), first2(converter2::call(first2)), f(f) {}
62 first1_type first1;
63 first2_type first2;
64 transform_type f;
68 #endif