2 #ifndef BOOST_MPL_TRANSFORM_HPP_INCLUDED
\r
3 #define BOOST_MPL_TRANSFORM_HPP_INCLUDED
\r
5 // Copyright Aleksey Gurtovoy 2000-2004
\r
6 // Copyright David Abrahams 2003-2004
\r
8 // Distributed under the Boost Software License, Version 1.0.
\r
9 // (See accompanying file LICENSE_1_0.txt or copy at
\r
10 // http://www.boost.org/LICENSE_1_0.txt)
\r
12 // See http://www.boost.org/libs/mpl for documentation.
\r
14 // $Id: transform.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
\r
15 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
\r
16 // $Revision: 49267 $
\r
18 #include <boost/mpl/fold.hpp>
\r
19 #include <boost/mpl/reverse_fold.hpp>
\r
20 #include <boost/mpl/pair_view.hpp>
\r
21 #include <boost/mpl/is_sequence.hpp>
\r
22 #include <boost/mpl/eval_if.hpp>
\r
23 #include <boost/mpl/lambda.hpp>
\r
24 #include <boost/mpl/bind.hpp>
\r
25 #include <boost/mpl/or.hpp>
\r
26 #include <boost/mpl/not.hpp>
\r
27 #include <boost/mpl/aux_/na.hpp>
\r
28 #include <boost/mpl/aux_/inserter_algorithm.hpp>
\r
30 namespace boost { namespace mpl {
\r
39 struct transform1_impl
\r
42 , typename In::state
\r
43 , bind2< typename lambda< typename In::operation >::type
\r
45 , bind1< typename lambda<Op>::type, _2>
\r
56 struct reverse_transform1_impl
\r
59 , typename In::state
\r
60 , bind2< typename lambda< typename In::operation >::type
\r
62 , bind1< typename lambda<Op>::type, _2>
\r
74 struct transform2_impl
\r
76 pair_view<Seq1,Seq2>
\r
77 , typename In::state
\r
78 , bind2< typename lambda< typename In::operation >::type
\r
81 typename lambda<Op>::type
\r
83 , bind1<second<>,_2>
\r
96 struct reverse_transform2_impl
\r
98 pair_view<Seq1,Seq2>
\r
99 , typename In::state
\r
100 , bind2< typename lambda< typename In::operation >::type
\r
102 , bind2< typename lambda< Op >::type
\r
103 , bind1<first<>,_2>
\r
104 , bind1<second<>,_2>
\r
111 } // namespace aux
\r
113 BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, transform1)
\r
114 BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, transform2)
\r
116 #define AUX778076_TRANSFORM_DEF(name) \
\r
118 typename BOOST_MPL_AUX_NA_PARAM(Seq1) \
\r
119 , typename BOOST_MPL_AUX_NA_PARAM(Seq2OrOperation) \
\r
120 , typename BOOST_MPL_AUX_NA_PARAM(OperationOrInserter) \
\r
121 , typename BOOST_MPL_AUX_NA_PARAM(Inserter) \
\r
125 typedef typename eval_if< \
\r
127 is_na<OperationOrInserter> \
\r
128 , is_lambda_expression< Seq2OrOperation > \
\r
129 , not_< is_sequence<Seq2OrOperation> > \
\r
131 , name##1<Seq1,Seq2OrOperation,OperationOrInserter> \
\r
132 , name##2<Seq1,Seq2OrOperation,OperationOrInserter,Inserter> \
\r
135 BOOST_MPL_AUX_NA_SPEC(4, name) \
\r
138 AUX778076_TRANSFORM_DEF(transform)
\r
139 AUX778076_TRANSFORM_DEF(reverse_transform)
\r
141 #undef AUX778076_TRANSFORM_DEF
\r
145 #endif // BOOST_MPL_TRANSFORM_HPP_INCLUDED
\r