mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Define EIGEN_CPLUSPLUS and replace most __cplusplus checks.
The macro `__cplusplus` is not defined correctly in MSVC unless building with the the `/Zc:__cplusplus` flag. Instead, it defines `_MSVC_LANG` to the specified c++ standard version number. Here we introduce `EIGEN_CPLUSPLUS` which will contain the c++ version number both for MSVC and otherwise. This simplifies checks for supported features. Also replaced most instances of standard version checking via `__cplusplus` with the existing `EIGEN_COMP_CXXVER` macro for better clarity. Fixes: #2170
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
82d61af3a4
commit
2468253c9a
@@ -45,7 +45,7 @@
|
||||
#include <queue>
|
||||
#include <cassert>
|
||||
#include <list>
|
||||
#if __cplusplus >= 201103L
|
||||
#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
|
||||
#include <random>
|
||||
#include <chrono>
|
||||
#ifdef EIGEN_USE_THREADS
|
||||
|
||||
@@ -761,7 +761,7 @@ void packetmath_real() {
|
||||
}
|
||||
}
|
||||
|
||||
#if EIGEN_HAS_C99_MATH && (__cplusplus > 199711L)
|
||||
#if EIGEN_HAS_C99_MATH && (EIGEN_COMP_CXXVER >= 11)
|
||||
data1[0] = std::numeric_limits<Scalar>::infinity();
|
||||
data1[1] = Scalar(-1);
|
||||
CHECK_CWISE1_IF(PacketTraits::HasLog1p, std::log1p, internal::plog1p);
|
||||
|
||||
@@ -413,7 +413,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
|
||||
|
||||
m.setFromTriplets(triplets.begin(), triplets.end(), std::multiplies<Scalar>());
|
||||
VERIFY_IS_APPROX(m, refMat_prod);
|
||||
#if (defined(__cplusplus) && __cplusplus >= 201103L)
|
||||
#if (EIGEN_COMP_CXXVER >= 11)
|
||||
m.setFromTriplets(triplets.begin(), triplets.end(), [] (Scalar,Scalar b) { return b; });
|
||||
VERIFY_IS_APPROX(m, refMat_last);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user