• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H
12 
13 
14 /** use this macro in sfinae selection in templated functions
15  *
16  *   template<typename T,
17  *            typename std::enable_if< isBanana<T>::value , int >::type = 0
18  *   >
19  *   void foo(){}
20  *
21  *   becomes =>
22  *
23  *   template<typename TopoType,
24  *           SFINAE_ENABLE_IF( isBanana<T>::value )
25  *   >
26  *   void foo(){}
27  */
28 
29 // SFINAE requires variadic templates
30 #ifndef __CUDACC__
31 #if EIGEN_HAS_VARIADIC_TEMPLATES
32   // SFINAE doesn't work for gcc <= 4.7
33   #ifdef EIGEN_COMP_GNUC
34     #if EIGEN_GNUC_AT_LEAST(4,8)
35       #define EIGEN_HAS_SFINAE
36     #endif
37   #else
38     #define EIGEN_HAS_SFINAE
39   #endif
40 #endif
41 #endif
42 
43 #define EIGEN_SFINAE_ENABLE_IF( __condition__ ) \
44     typename internal::enable_if< ( __condition__ ) , int >::type = 0
45 
46 
47 #if EIGEN_HAS_CONSTEXPR
48 #define EIGEN_CONSTEXPR constexpr
49 #else
50 #define EIGEN_CONSTEXPR
51 #endif
52 
53 
54 #endif
55