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
// Sacado Package
4
//
5
// Copyright 2006 NTESS and the Sacado contributors.
6
// SPDX-License-Identifier: LGPL-2.1-or-later
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef SACADO_SFINAE_MACROS_H
11
#define SACADO_SFINAE_MACROS_H
12
13
#include <type_traits>
14
15
#include "
Sacado_mpl_enable_if.hpp
"
16
#include "
Sacado_mpl_disable_if.hpp
"
17
#include "
Sacado_mpl_type_wrap.hpp
"
18
19
/* Define some macros useful for disabling template function overloads */
20
#define SACADO_ENABLE_IF_SAME(TYPE1, TYPE2, RETURN_TYPE) \
21
typename mpl::enable_if_c<std::is_convertible< TYPE1 , TYPE2 >::value && ExprLevel<TYPE1>::value == ExprLevel<TYPE2>::value, RETURN_TYPE >::type
22
#define SACADO_ENABLE_EXPR_FUNC(RETURN_TYPE) \
23
SACADO_ENABLE_IF_SAME(typename Expr<S>::value_type, value_type, RETURN_TYPE)
24
#define SACADO_ENABLE_EXPR_CTOR_DEF SACADO_ENABLE_EXPR_FUNC(void*)
25
#define SACADO_ENABLE_EXPR_CTOR_DECL SACADO_ENABLE_EXPR_CTOR_DEF = 0
26
#define SACADO_FAD_ENABLE_EXPR_FUNC \
27
SACADO_ENABLE_IF_SAME(typename Expr<S>::value_type, typename FAD::value_type, FAD&)
28
29
#define SACADO_EXP_ENABLE_EXPR_FUNC(RETURN_TYPE) \
30
SACADO_ENABLE_IF_SAME(typename Expr<S>::derived_type::value_type, value_type, RETURN_TYPE)
31
#define SACADO_EXP_ENABLE_EXPR_CTOR_DEF \
32
typename mpl::enable_if_c< \
33
std::is_convertible< typename Expr<S>::derived_type::value_type , \
34
value_type >::value && \
35
(ExprLevel< typename Expr<S>::derived_type::value_type >::value == \
36
ExprLevel< value_type >::value) && \
37
!is_view, void* >::type
38
#define SACADO_EXP_ENABLE_EXPR_CTOR_DECL SACADO_EXP_ENABLE_EXPR_CTOR_DEF = 0
39
#define SACADO_FAD_EXP_ENABLE_EXPR_FUNC \
40
SACADO_ENABLE_IF_SAME(typename Expr<S>::derived_type::value_type, typename FAD::value_type, FAD&)
41
42
#define SACADO_ENABLE_IF_CONVERTIBLE(TYPE1, TYPE2, RETURN_TYPE) \
43
typename Sacado::mpl::enable_if<std::is_convertible< TYPE1 , TYPE2 >, RETURN_TYPE >::type
44
#define SACADO_ENABLE_VALUE_FUNC(RETURN_TYPE) \
45
SACADO_ENABLE_IF_CONVERTIBLE(S, value_type, RETURN_TYPE)
46
#define SACADO_ENABLE_VALUE_CTOR_DEF SACADO_ENABLE_VALUE_FUNC(void*)
47
#define SACADO_ENABLE_VALUE_CTOR_DECL SACADO_ENABLE_VALUE_CTOR_DEF = 0
48
49
#define SACADO_EXP_ENABLE_VALUE_CTOR_DEF \
50
typename mpl::enable_if_c< \
51
std::is_convertible< S , value_type >::value && \
52
!is_view, void* >::type
53
#define SACADO_EXP_ENABLE_VALUE_CTOR_DECL SACADO_EXP_ENABLE_VALUE_CTOR_DEF = 0
54
55
#define SACADO_FAD_OP_ENABLE_EXPR_EXPR(OP) \
56
typename mpl::enable_if_c< IsFadExpr<T1>::value && IsFadExpr<T2>::value && \
57
ExprLevel<T1>::value == ExprLevel<T2>::value, \
58
Expr< OP< T1, T2 > > \
59
>::type
60
#define SACADO_FAD_EXP_OP_ENABLE_EXPR_EXPR(OP) \
61
typename mpl::enable_if_c< IsFadExpr<T1>::value && IsFadExpr<T2>::value && \
62
ExprLevel<T1>::value == ExprLevel<T2>::value, \
63
OP< typename Expr<T1>::derived_type, typename Expr<T2>::derived_type, false, false, typename T1::expr_spec_type > \
64
>::type
65
#define SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP) \
66
typename mpl::disable_if<std::is_same< typename Expr<T>::value_type, typename Expr<T>::scalar_type>, Expr< OP< ConstExpr<typename Expr<T>::scalar_type>, Expr<T> > > >::type
67
#define SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP) \
68
typename mpl::disable_if<std::is_same< typename Expr<T>::value_type, typename Expr<T>::scalar_type>, Expr< OP< Expr<T>, ConstExpr<typename Expr<T>::scalar_type> > > >::type
69
#define SACADO_FAD_EXP_OP_ENABLE_SCALAR_EXPR(OP) \
70
typename mpl::disable_if<std::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
71
#define SACADO_FAD_EXP_OP_ENABLE_EXPR_SCALAR(OP) \
72
typename mpl::disable_if<std::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
73
74
#endif // SACADO_SFINAE_MACROS_H
Sacado_mpl_type_wrap.hpp
Sacado_mpl_disable_if.hpp
Sacado_mpl_enable_if.hpp
Generated on Thu Nov 21 2024 09:24:01 for Sacado Package Browser (Single Doxygen Collection) by
1.8.5