diff --git a/src/array.hpp b/src/array.hpp index 3bfaec5d04cb479845a1a76f01969430af9a9640..5fca6751d7b675fcf47c647d4d679972bec62e3f 100644 --- a/src/array.hpp +++ b/src/array.hpp @@ -14,10 +14,22 @@ #include <initializer_list> #include <stdexcept> +#include <Eigen/Core> + namespace array { constexpr size_t Dynamic = SIZE_MAX; +#ifdef __GNUC__ +#define ARRAY_RESTRICT __restrict +#else +#ifdef EIGEN_RESTRICT +#define ARRAY_RESTRICT EIGEN_RESTRICT +#else +#define ARRAY_RESTRICT +#endif +#endif + #ifdef NDEBUG constexpr bool bounds_check = false; #else @@ -288,7 +300,7 @@ public: protected: typedef detail::Base<Shape> Base; - Scalar *data_; + Scalar *ARRAY_RESTRICT data_; template <size_t axis> static constexpr Eigen::Index eigen_shape()