From b9f1b28638488a228d2706f50a0827bf58bb8c13 Mon Sep 17 00:00:00 2001 From: Joe Naegele Date: Thu, 20 Nov 2025 22:31:14 +0000 Subject: [PATCH] Fix xtensor includes for compat with xtensor >= 0.26 See https://github.com/xtensor-stack/xtensor/pull/2829 --- cpp/sandbox/sandbox.cc | 2 -- cpp/test/external/ndarray_impl.h | 10 ++++++++++ docs/cpp/arrays.md | 2 +- environment.yml | 2 +- tooling/internal/cpp/include/detail/ndarray/impl.h | 13 +++++++++++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/cpp/sandbox/sandbox.cc b/cpp/sandbox/sandbox.cc index 8a08ad91..1a39a089 100644 --- a/cpp/sandbox/sandbox.cc +++ b/cpp/sandbox/sandbox.cc @@ -4,8 +4,6 @@ #include #include -#include - #include "generated/binary/protocols.h" #include "generated/hdf5/protocols.h" #include "generated/ndjson/protocols.h" diff --git a/cpp/test/external/ndarray_impl.h b/cpp/test/external/ndarray_impl.h index e39a2675..8187cf18 100644 --- a/cpp/test/external/ndarray_impl.h +++ b/cpp/test/external/ndarray_impl.h @@ -3,7 +3,17 @@ #include #include +#if __has_include() +#include +#else +#include +#endif + +#if XTENSOR_VERSION_MAJOR == 0 && XTENSOR_VERSION_MINOR <= 25 #include +#else +#include +#endif #include "hoNDArray.h" diff --git a/docs/cpp/arrays.md b/docs/cpp/arrays.md index f1637e9b..f133269c 100644 --- a/docs/cpp/arrays.md +++ b/docs/cpp/arrays.md @@ -34,7 +34,7 @@ For example, an override header may look like the following: /** Include multi-dimensional array implementation(s) **/ #include #include -#include +#include namespace yardl { diff --git a/environment.yml b/environment.yml index b9f1f164..e920de57 100644 --- a/environment.yml +++ b/environment.yml @@ -29,4 +29,4 @@ dependencies: - rich=14.1.0 - shellcheck=0.10.0 # local - valgrind=3.25.1 # local arch=x86_64 - - xtensor=0.25.0 + - xtensor=0.27.1 diff --git a/tooling/internal/cpp/include/detail/ndarray/impl.h b/tooling/internal/cpp/include/detail/ndarray/impl.h index 53a966be..adef8090 100644 --- a/tooling/internal/cpp/include/detail/ndarray/impl.h +++ b/tooling/internal/cpp/include/detail/ndarray/impl.h @@ -2,10 +2,23 @@ #include +#if __has_include() +#include +#else +#include +#endif + +#if XTENSOR_VERSION_MAJOR == 0 && XTENSOR_VERSION_MINOR <= 25 #include #include #include #include +#else +#include +#include +#include +#include +#endif namespace yardl {