]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/mpl/aux_/transform_iter.hpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
9ca7106fd44ce06bb293163d8ff2804866b33ca5
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / mpl / aux_ / transform_iter.hpp
1 \r
2 #ifndef BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED\r
3 #define BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED\r
4 \r
5 // Copyright Aleksey Gurtovoy 2000-2004\r
6 //\r
7 // Distributed under the Boost Software License, Version 1.0. \r
8 // (See accompanying file LICENSE_1_0.txt or copy at \r
9 // http://www.boost.org/LICENSE_1_0.txt)\r
10 //\r
11 // See http://www.boost.org/libs/mpl for documentation.\r
12 \r
13 // $Id: transform_iter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $\r
14 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $\r
15 // $Revision: 49267 $\r
16 \r
17 #include <boost/mpl/apply.hpp>\r
18 #include <boost/mpl/iterator_tags.hpp>\r
19 #include <boost/mpl/next.hpp>\r
20 #include <boost/mpl/deref.hpp>\r
21 #include <boost/mpl/aux_/lambda_spec.hpp>\r
22 #include <boost/mpl/aux_/config/ctps.hpp>\r
23 #include <boost/type_traits/is_same.hpp>\r
24 \r
25 namespace boost { namespace mpl { \r
26 \r
27 namespace aux {\r
28 \r
29 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
30 \r
31 template<\r
32       typename Iterator\r
33     , typename LastIterator\r
34     , typename F\r
35     >\r
36 struct transform_iter\r
37 {\r
38     typedef Iterator base;\r
39     typedef forward_iterator_tag category;\r
40     typedef transform_iter< typename mpl::next<base>::type,LastIterator,F > next;\r
41     \r
42     typedef typename apply1<\r
43           F\r
44         , typename deref<base>::type\r
45         >::type type;\r
46 };\r
47 \r
48 template<\r
49       typename LastIterator\r
50     , typename F\r
51     >\r
52 struct transform_iter< LastIterator,LastIterator,F >\r
53 {\r
54     typedef LastIterator base;\r
55     typedef forward_iterator_tag category;\r
56 };\r
57 \r
58 #else\r
59 \r
60 template<\r
61       typename Iterator\r
62     , typename LastIterator\r
63     , typename F\r
64     >\r
65 struct transform_iter;\r
66 \r
67 template< bool >\r
68 struct transform_iter_impl \r
69 {\r
70     template<\r
71           typename Iterator\r
72         , typename LastIterator\r
73         , typename F\r
74         >\r
75     struct result_\r
76     {\r
77         typedef Iterator base;\r
78         typedef forward_iterator_tag category;\r
79         typedef transform_iter< typename mpl::next<Iterator>::type,LastIterator,F > next;\r
80         \r
81         typedef typename apply1<\r
82               F\r
83             , typename deref<Iterator>::type\r
84             >::type type;\r
85     };\r
86 };\r
87 \r
88 template<>\r
89 struct transform_iter_impl<true>\r
90 {\r
91     template<\r
92           typename Iterator\r
93         , typename LastIterator\r
94         , typename F\r
95         >\r
96     struct result_\r
97     {\r
98         typedef Iterator base;\r
99         typedef forward_iterator_tag category;\r
100     };\r
101 };\r
102 \r
103 template<\r
104       typename Iterator\r
105     , typename LastIterator\r
106     , typename F\r
107     >\r
108 struct transform_iter\r
109     : transform_iter_impl<\r
110           ::boost::is_same<Iterator,LastIterator>::value\r
111         >::template result_< Iterator,LastIterator,F >\r
112 {\r
113 };\r
114 \r
115 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION\r
116 \r
117 } // namespace aux\r
118 \r
119 BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, aux::transform_iter)\r
120 \r
121 }}\r
122 \r
123 #endif // BOOST_MPL_AUX_TRANSFORM_ITER_HPP_INCLUDED\r