Skip to content

Commit f2695c6

Browse files
EIGEN_HAS_MAJOR_VERSION_5 -> EIGEN_HAS_CXX17,
more dox
1 parent 0602574 commit f2695c6

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/TiledArray/external/eigen.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ TILEDARRAY_PRAGMA_GCC(diagnostic pop)
6363
#endif
6464
#endif // EIGEN_USE_LAPACKE || EIGEN_USE_LAPACKE_STRICT
6565

66-
#if EIGEN_VERSION_AT_LEAST(3, 5, 0)
67-
#define EIGEN_HAS_MAJOR_VERSION_5 1
66+
// Eigen >= 5.x is last to support C++14, future releases require C++17
67+
// https://gitlab.com/libeigen/eigen/-/releases/5.0.0
68+
#if EIGEN_MAJOR_VERSION > 4
69+
#define EIGEN_HAS_CXX17 1
6870
#endif
6971

7072
TILEDARRAY_PRAGMA_GCC(diagnostic pop)

src/TiledArray/fwd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
// #include <boost/container/detail/std_fwd.hpp>
3030

3131
// fwddecl Eigen::aligned_allocator
32+
// N.B. with Eigen >= 5.x, aligned_allocator no longer inherits from
33+
// std::allocator https://gitlab.com/libeigen/eigen/-/merge_requests/1795
3234
namespace Eigen {
3335
template <class>
3436
class aligned_allocator;

src/TiledArray/tensor/tensor.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ class Tensor {
185185
: range_(range), nbatch_(nbatch) {
186186
size_t size = range_.volume() * nbatch;
187187
allocator_type allocator;
188-
#if EIGEN_HAS_MAJOR_VERSION_5
189-
// Eigen >=3.5.0 returns nullptr if size=0
188+
#if EIGEN_HAS_CXX17
189+
// Eigen (>= 5.x) allocate returns nullptr if size=0
190190
auto* ptr = (!size && range_.rank())
191191
? static_cast<pointer>(std::malloc(size))
192192
: allocator.allocate(size);
@@ -233,8 +233,8 @@ class Tensor {
233233
: range_(std::move(range)), nbatch_(nbatch) {
234234
size_t size = range_.volume() * nbatch;
235235
allocator_type allocator;
236-
#if EIGEN_HAS_MAJOR_VERSION_5
237-
// Eigen >=3.5.0 returns nullptr if size=0
236+
#if EIGEN_HAS_CXX17
237+
// Eigen (>= 5.x) allocate returns nullptr if size=0
238238
auto* ptr = (!size && range_.rank())
239239
? static_cast<pointer>(std::malloc(size))
240240
: allocator.allocate(size);

0 commit comments

Comments
 (0)