Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_mpl_lambda.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Sacado Package
5 // Copyright (2006) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
25 // (etphipp@sandia.gov).
26 //
27 // ***********************************************************************
28 // @HEADER
29 
30 #ifndef SACADO_MPL_LAMBDA_HPP
31 #define SACADO_MPL_LAMBDA_HPP
32 
33 #include "Sacado_mpl_bind.hpp"
34 #include "Sacado_mpl_quote.hpp"
35 #include "Sacado_mpl_type_wrap.hpp"
36 #include "Sacado_mpl_if.hpp"
38 
39 namespace Sacado {
40 
41  namespace mpl {
42 
43  template <class F> struct lambda : mpl::type_wrap<F> {};
44 
45  template <template<class T1> class F,
46  class T1>
47  struct lambda< F<T1> > :
48  mpl_if< is_placeholder< F<T1> >,
49  type_wrap< bind1< quote1<F>,
50  typename lambda<T1>::type > >,
51  type_wrap< F<T1> > > {};
52 
53  template <template<class T1, class T2> class F,
54  class T1,
55  class T2>
56  struct lambda< F<T1,T2> > :
57  mpl_if< is_placeholder< F<T1,T2> >,
58  type_wrap< bind2< quote2<F>,
59  typename lambda<T1>::type,
60  typename lambda<T2>::type > >,
61  type_wrap< F<T1,T2> > > {};
62 
63  template <template<class T1, class T2, class T3> class F,
64  class T1,
65  class T2,
66  class T3>
67  struct lambda< F<T1,T2,T3> > :
68  mpl_if< is_placeholder< F<T1,T2,T3> >,
69  type_wrap< bind3< quote3<F>,
70  typename lambda<T1>::type,
71  typename lambda<T2>::type,
72  typename lambda<T3>::type > >,
73  type_wrap< F<T1,T2,T3> > > {};
74 
75  template <template<class T1, class T2, class T3, class T4> class F,
76  class T1,
77  class T2,
78  class T3,
79  class T4>
80  struct lambda< F<T1,T2,T3,T4> > :
81  mpl_if< is_placeholder< F<T1,T2,T3,T4> >,
82  type_wrap< bind4< quote4<F>,
83  typename lambda<T1>::type,
84  typename lambda<T2>::type,
85  typename lambda<T3>::type,
86  typename lambda<T4>::type > >,
87  type_wrap< F<T1,T2,T3,T4> > > {};
88 
89  template <template<class T1, class T2, class T3, class T4, class T5> class F,
90  class T1,
91  class T2,
92  class T3,
93  class T4,
94  class T5>
95  struct lambda< F<T1,T2,T3,T4,T5> > :
96  mpl_if< is_placeholder< F<T1,T2,T3,T4,T5> >,
97  type_wrap< bind5< quote5<F>,
98  typename lambda<T1>::type,
99  typename lambda<T2>::type,
100  typename lambda<T3>::type,
101  typename lambda<T4>::type,
102  typename lambda<T5>::type > >,
103  type_wrap< F<T1,T2,T3,T4,T5> > > {};
104 
105  } // namespace mpl
106 
107 } // namespace Sacado
108 
109 #endif // SACADO_MPL_LAMBDA_HPP
Sacado::Fad::DFad< double > F
Definition: ad_example.cpp:40
#define T2(r, f)
Definition: Sacado_rad.hpp:578
#define T1(r, f)
Definition: Sacado_rad.hpp:603