Skip to content

Commit 4269ce7

Browse files
Romain-Geissler-1Asteppi
authored andcommitted
BLD: Force defining the mdspan parenthesis operator even with C++ >= 23. (#22588)
This allows to keep the same code, independently of the compiler C++ dialect being used. The default behavior of kokkos mdspan is the following: - if __cpp_multidimensional_subscript is defined (ie C++ >= 23), then enable by default the square bracket operator to access elements, and disable by default the parenthesis operator. - otherwise (C++ < 23), disable the square bracket operator which cannot work, and replace it by the parenthesis operator instead. The current xsf code always uses the parenthesis operator. To avoid having to always write the two possibilities, force the kokkos mdspan implementation to always define the parenthesis operator for now. Signed-off-by: Romain Geissler <[email protected]>
1 parent 699eb97 commit 4269ce7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/xsf/numpy.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
#include "dual.h"
2121
#include "error.h"
22+
// Force defining the parenthesis operator even when compiling with a compiler
23+
// defaulting to C++ >= 23.
24+
#define MDSPAN_USE_PAREN_OPERATOR 1
2225
#include "third_party/kokkos/mdspan.hpp"
2326

2427
/* PyUFunc_getfperr gets bits for current floating point error (fpe) status codes so we

0 commit comments

Comments
 (0)