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 SACADO_EXP_ENABLE_EXPR_FUNC(void*)
52
#define SACADO_EXP_ENABLE_EXPR_CTOR_DECL SACADO_EXP_ENABLE_EXPR_CTOR_DEF = 0
53
#define SACADO_FAD_EXP_ENABLE_EXPR_FUNC \
54
SACADO_ENABLE_IF_SAME(typename Expr<S>::derived_type::value_type, typename FAD::value_type, FAD&)
55
56
#define SACADO_ENABLE_IF_CONVERTIBLE(TYPE1, TYPE2, RETURN_TYPE) \
57
typename Sacado::mpl::enable_if<Sacado::mpl::is_convertible< TYPE1 , TYPE2 >, RETURN_TYPE >::type
58
#define SACADO_ENABLE_VALUE_FUNC(RETURN_TYPE) \
59
SACADO_ENABLE_IF_CONVERTIBLE(S, value_type, RETURN_TYPE)
60
#define SACADO_ENABLE_VALUE_CTOR_DEF SACADO_ENABLE_VALUE_FUNC(void*)
61
#define SACADO_ENABLE_VALUE_CTOR_DECL SACADO_ENABLE_VALUE_CTOR_DEF = 0
62
63
#define SACADO_FAD_OP_ENABLE_EXPR_EXPR(OP) \
64
typename mpl::enable_if_c< IsFadExpr<T1>::value && IsFadExpr<T2>::value && \
65
ExprLevel<T1>::value == ExprLevel<T2>::value, \
66
Expr< OP< T1, T2 > > \
67
>::type
68
#define SACADO_FAD_EXP_OP_ENABLE_EXPR_EXPR(OP) \
69
typename mpl::enable_if_c< IsFadExpr<T1>::value && IsFadExpr<T2>::value && \
70
ExprLevel<T1>::value == ExprLevel<T2>::value, \
71
OP< typename Expr<T1>::derived_type, typename Expr<T2>::derived_type, false, false, typename T1::expr_spec_type > \
72
>::type
73
#define SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP) \
74
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
75
#define SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP) \
76
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
77
#define SACADO_FAD_EXP_OP_ENABLE_SCALAR_EXPR(OP) \
78
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
79
#define SACADO_FAD_EXP_OP_ENABLE_EXPR_SCALAR(OP) \
80
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
81
82
#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