Sacado Package Browser (Single Doxygen Collection)
Version of the Day
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
Sacado_SFINAE_Macros.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_SFINAE_MACROS_H
31
#define SACADO_SFINAE_MACROS_H
32
33
#include "
Sacado_mpl_enable_if.hpp
"
34
#include "
Sacado_mpl_disable_if.hpp
"
35
#include "
Sacado_mpl_is_same.hpp
"
36
#include "
Sacado_mpl_is_convertible.hpp
"
37
#include "
Sacado_mpl_type_wrap.hpp
"
38
39
/* Define some macros useful for disabling template function overloads */
40
#define SACADO_ENABLE_IF_SAME(TYPE1, TYPE2, RETURN_TYPE) \
41
typename mpl::enable_if_c<mpl::is_convertible< TYPE1 , TYPE2 >::value && ExprLevel<TYPE1>::value == ExprLevel<TYPE2>::value, RETURN_TYPE >::type
42
#define SACADO_ENABLE_EXPR_FUNC(RETURN_TYPE) \
43
SACADO_ENABLE_IF_SAME(typename Expr<S>::value_type, value_type, RETURN_TYPE)
44
#define SACADO_ENABLE_EXPR_CTOR_DEF SACADO_ENABLE_EXPR_FUNC(void*)
45
#define SACADO_ENABLE_EXPR_CTOR_DECL SACADO_ENABLE_EXPR_CTOR_DEF = 0
46
#define SACADO_FAD_ENABLE_EXPR_FUNC \
47
SACADO_ENABLE_IF_SAME(typename Expr<S>::value_type, typename FAD::value_type, FAD&)
48
49
#define SACADO_EXP_ENABLE_EXPR_FUNC(RETURN_TYPE) \
50
SACADO_ENABLE_IF_SAME(typename Expr<S>::derived_type::value_type, value_type, RETURN_TYPE)
51
#define SACADO_EXP_ENABLE_EXPR_CTOR_DEF \
52
typename mpl::enable_if_c< \
53
mpl::is_convertible< typename Expr<S>::derived_type::value_type , \
54
value_type >::value && \
55
(ExprLevel< typename Expr<S>::derived_type::value_type >::value == \
56
ExprLevel< value_type >::value) && \
57
!is_view, void* >::type
58
#define SACADO_EXP_ENABLE_EXPR_CTOR_DECL SACADO_EXP_ENABLE_EXPR_CTOR_DEF = 0
59
#define SACADO_FAD_EXP_ENABLE_EXPR_FUNC \
60
SACADO_ENABLE_IF_SAME(typename Expr<S>::derived_type::value_type, typename FAD::value_type, FAD&)
61
62
#define SACADO_ENABLE_IF_CONVERTIBLE(TYPE1, TYPE2, RETURN_TYPE) \
63
typename Sacado::mpl::enable_if<Sacado::mpl::is_convertible< TYPE1 , TYPE2 >, RETURN_TYPE >::type
64
#define SACADO_ENABLE_VALUE_FUNC(RETURN_TYPE) \
65
SACADO_ENABLE_IF_CONVERTIBLE(S, value_type, RETURN_TYPE)
66
#define SACADO_ENABLE_VALUE_CTOR_DEF SACADO_ENABLE_VALUE_FUNC(void*)
67
#define SACADO_ENABLE_VALUE_CTOR_DECL SACADO_ENABLE_VALUE_CTOR_DEF = 0
68
69
#define SACADO_EXP_ENABLE_VALUE_CTOR_DEF \
70
typename mpl::enable_if_c< \
71
Sacado::mpl::is_convertible< S , value_type >::value && \
72
!is_view, void* >::type
73
#define SACADO_EXP_ENABLE_VALUE_CTOR_DECL SACADO_EXP_ENABLE_VALUE_CTOR_DEF = 0
74
75
#define SACADO_FAD_OP_ENABLE_EXPR_EXPR(OP) \
76
typename mpl::enable_if_c< IsFadExpr<T1>::value && IsFadExpr<T2>::value && \
77
ExprLevel<T1>::value == ExprLevel<T2>::value, \
78
Expr< OP< T1, T2 > > \
79
>::type
80
#define SACADO_FAD_EXP_OP_ENABLE_EXPR_EXPR(OP) \
81
typename mpl::enable_if_c< IsFadExpr<T1>::value && IsFadExpr<T2>::value && \
82
ExprLevel<T1>::value == ExprLevel<T2>::value, \
83
OP< typename Expr<T1>::derived_type, typename Expr<T2>::derived_type, false, false, typename T1::expr_spec_type > \
84
>::type
85
#define SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP) \
86
typename mpl::disable_if<mpl::is_same< typename Expr<T>::value_type, typename Expr<T>::scalar_type>, Expr< OP< ConstExpr<typename Expr<T>::scalar_type>, Expr<T> > > >::type
87
#define SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP) \
88
typename mpl::disable_if<mpl::is_same< typename Expr<T>::value_type, typename Expr<T>::scalar_type>, Expr< OP< Expr<T>, ConstExpr<typename Expr<T>::scalar_type> > > >::type
89
#define SACADO_FAD_EXP_OP_ENABLE_SCALAR_EXPR(OP) \
90
typename mpl::disable_if<mpl::is_same< typename T::value_type, typename T::scalar_type>, OP< typename T::scalar_type, typename Expr<T>::derived_type, true, false, typename T::expr_spec_type > >::type
91
#define SACADO_FAD_EXP_OP_ENABLE_EXPR_SCALAR(OP) \
92
typename mpl::disable_if<mpl::is_same< typename T::value_type, typename T::scalar_type>, OP< typename Expr<T>::derived_type, typename T::scalar_type, false, true, typename T::expr_spec_type > >::type
93
94
#endif // SACADO_SFINAE_MACROS_H
Sacado_mpl_type_wrap.hpp
Sacado_mpl_is_convertible.hpp
Sacado_mpl_is_same.hpp
Sacado_mpl_disable_if.hpp
Sacado_mpl_enable_if.hpp
Generated by
1.8.5