New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
transform.hpp in vendors/XIOS/current/extern/boost/include/boost/mpl – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/mpl/transform.hpp @ 3408

Last change on this file since 3408 was 3408, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1
2#ifndef BOOST_MPL_TRANSFORM_HPP_INCLUDED
3#define BOOST_MPL_TRANSFORM_HPP_INCLUDED
4
5// Copyright Aleksey Gurtovoy 2000-2004
6// Copyright David Abrahams 2003-2004
7//
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)
11//
12// See http://www.boost.org/libs/mpl for documentation.
13
14// $Id$
15// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
16// $Revision: 49267 $
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>
29
30namespace boost { namespace mpl {
31
32namespace aux { 
33
34template< 
35      typename Seq
36    , typename Op
37    , typename In
38    >
39struct transform1_impl
40    : fold< 
41          Seq
42        , typename In::state
43        , bind2< typename lambda< typename In::operation >::type
44            , _1
45            , bind1< typename lambda<Op>::type, _2>
46            > 
47        >
48{
49};
50
51template< 
52      typename Seq
53    , typename Op
54    , typename In
55    >
56struct reverse_transform1_impl
57    : reverse_fold< 
58          Seq
59        , typename In::state
60        , bind2< typename lambda< typename In::operation >::type
61            , _1
62            , bind1< typename lambda<Op>::type, _2>
63            > 
64        >
65{
66};
67
68template< 
69      typename Seq1
70    , typename Seq2
71    , typename Op
72    , typename In
73    >
74struct transform2_impl
75    : fold< 
76          pair_view<Seq1,Seq2>
77        , typename In::state
78        , bind2< typename lambda< typename In::operation >::type
79            , _1
80            , bind2<
81                  typename lambda<Op>::type
82                , bind1<first<>,_2>
83                , bind1<second<>,_2>
84                >
85            > 
86        >
87{
88};
89
90template< 
91      typename Seq1
92    , typename Seq2
93    , typename Op
94    , typename In
95    >
96struct reverse_transform2_impl
97    : reverse_fold< 
98          pair_view<Seq1,Seq2>
99        , typename In::state
100        , bind2< typename lambda< typename In::operation >::type
101            , _1
102            , bind2< typename lambda< Op >::type
103                , bind1<first<>,_2>
104                , bind1<second<>,_2>
105                >
106            > 
107        >
108{
109};
110
111} // namespace aux
112
113BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, transform1)                   
114BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, transform2)
115   
116#define AUX778076_TRANSFORM_DEF(name)                                   \
117template<                                                               \
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)                         \
122    >                                                                   \
123struct name                                                             \
124{                                                                       \
125    typedef typename eval_if<                                           \
126          or_<                                                          \
127              is_na<OperationOrInserter>                                \
128            , is_lambda_expression< Seq2OrOperation >                   \
129            , not_< is_sequence<Seq2OrOperation> >                      \
130            >                                                           \
131        , name##1<Seq1,Seq2OrOperation,OperationOrInserter>             \
132        , name##2<Seq1,Seq2OrOperation,OperationOrInserter,Inserter>    \
133        >::type type;                                                   \
134};                                                                      \
135BOOST_MPL_AUX_NA_SPEC(4, name)                                          \
136/**/
137
138AUX778076_TRANSFORM_DEF(transform)
139AUX778076_TRANSFORM_DEF(reverse_transform)
140
141#undef AUX778076_TRANSFORM_DEF
142
143}}
144
145#endif // BOOST_MPL_TRANSFORM_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.