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