1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/mpl/transform.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,145 @@
1.4 +
1.5 +#ifndef BOOST_MPL_TRANSFORM_HPP_INCLUDED
1.6 +#define BOOST_MPL_TRANSFORM_HPP_INCLUDED
1.7 +
1.8 +// Copyright Aleksey Gurtovoy 2000-2004
1.9 +// Copyright David Abrahams 2003-2004
1.10 +//
1.11 +// Distributed under the Boost Software License, Version 1.0.
1.12 +// (See accompanying file LICENSE_1_0.txt or copy at
1.13 +// http://www.boost.org/LICENSE_1_0.txt)
1.14 +//
1.15 +// See http://www.boost.org/libs/mpl for documentation.
1.16 +
1.17 +// $Source: /cvsroot/boost/boost/boost/mpl/transform.hpp,v $
1.18 +// $Date: 2004/12/20 17:18:17 $
1.19 +// $Revision: 1.10 $
1.20 +
1.21 +#include <boost/mpl/fold.hpp>
1.22 +#include <boost/mpl/reverse_fold.hpp>
1.23 +#include <boost/mpl/pair_view.hpp>
1.24 +#include <boost/mpl/is_sequence.hpp>
1.25 +#include <boost/mpl/eval_if.hpp>
1.26 +#include <boost/mpl/lambda.hpp>
1.27 +#include <boost/mpl/bind.hpp>
1.28 +#include <boost/mpl/or.hpp>
1.29 +#include <boost/mpl/not.hpp>
1.30 +#include <boost/mpl/aux_/na.hpp>
1.31 +#include <boost/mpl/aux_/inserter_algorithm.hpp>
1.32 +
1.33 +namespace boost { namespace mpl {
1.34 +
1.35 +namespace aux {
1.36 +
1.37 +template<
1.38 + typename Seq
1.39 + , typename Op
1.40 + , typename In
1.41 + >
1.42 +struct transform1_impl
1.43 + : fold<
1.44 + Seq
1.45 + , typename In::state
1.46 + , bind2< typename lambda< typename In::operation >::type
1.47 + , _1
1.48 + , bind1< typename lambda<Op>::type, _2>
1.49 + >
1.50 + >
1.51 +{
1.52 +};
1.53 +
1.54 +template<
1.55 + typename Seq
1.56 + , typename Op
1.57 + , typename In
1.58 + >
1.59 +struct reverse_transform1_impl
1.60 + : reverse_fold<
1.61 + Seq
1.62 + , typename In::state
1.63 + , bind2< typename lambda< typename In::operation >::type
1.64 + , _1
1.65 + , bind1< typename lambda<Op>::type, _2>
1.66 + >
1.67 + >
1.68 +{
1.69 +};
1.70 +
1.71 +template<
1.72 + typename Seq1
1.73 + , typename Seq2
1.74 + , typename Op
1.75 + , typename In
1.76 + >
1.77 +struct transform2_impl
1.78 + : fold<
1.79 + pair_view<Seq1,Seq2>
1.80 + , typename In::state
1.81 + , bind2< typename lambda< typename In::operation >::type
1.82 + , _1
1.83 + , bind2<
1.84 + typename lambda<Op>::type
1.85 + , bind1<first<>,_2>
1.86 + , bind1<second<>,_2>
1.87 + >
1.88 + >
1.89 + >
1.90 +{
1.91 +};
1.92 +
1.93 +template<
1.94 + typename Seq1
1.95 + , typename Seq2
1.96 + , typename Op
1.97 + , typename In
1.98 + >
1.99 +struct reverse_transform2_impl
1.100 + : reverse_fold<
1.101 + pair_view<Seq1,Seq2>
1.102 + , typename In::state
1.103 + , bind2< typename lambda< typename In::operation >::type
1.104 + , _1
1.105 + , bind2< typename lambda< Op >::type
1.106 + , bind1<first<>,_2>
1.107 + , bind1<second<>,_2>
1.108 + >
1.109 + >
1.110 + >
1.111 +{
1.112 +};
1.113 +
1.114 +} // namespace aux
1.115 +
1.116 +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, transform1)
1.117 +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, transform2)
1.118 +
1.119 +#define AUX778076_TRANSFORM_DEF(name) \
1.120 +template< \
1.121 + typename BOOST_MPL_AUX_NA_PARAM(Seq1) \
1.122 + , typename BOOST_MPL_AUX_NA_PARAM(Seq2OrOperation) \
1.123 + , typename BOOST_MPL_AUX_NA_PARAM(OperationOrInserter) \
1.124 + , typename BOOST_MPL_AUX_NA_PARAM(Inserter) \
1.125 + > \
1.126 +struct name \
1.127 +{ \
1.128 + typedef typename eval_if< \
1.129 + or_< \
1.130 + is_na<OperationOrInserter> \
1.131 + , is_lambda_expression< Seq2OrOperation > \
1.132 + , not_< is_sequence<Seq2OrOperation> > \
1.133 + > \
1.134 + , name##1<Seq1,Seq2OrOperation,OperationOrInserter> \
1.135 + , name##2<Seq1,Seq2OrOperation,OperationOrInserter,Inserter> \
1.136 + >::type type; \
1.137 +}; \
1.138 +BOOST_MPL_AUX_NA_SPEC(4, name) \
1.139 +/**/
1.140 +
1.141 +AUX778076_TRANSFORM_DEF(transform)
1.142 +AUX778076_TRANSFORM_DEF(reverse_transform)
1.143 +
1.144 +#undef AUX778076_TRANSFORM_DEF
1.145 +
1.146 +}}
1.147 +
1.148 +#endif // BOOST_MPL_TRANSFORM_HPP_INCLUDED