From e290c8f820818b1b181860d3dd4d8ef9cd10241a Mon Sep 17 00:00:00 2001 From: vhinger Date: Mon, 13 Oct 2025 20:06:16 +0200 Subject: [PATCH] add stride-aware constructor for NDView --- include/aare/NDView.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/aare/NDView.hpp b/include/aare/NDView.hpp index 0aa4f78..98d7224 100644 --- a/include/aare/NDView.hpp +++ b/include/aare/NDView.hpp @@ -93,6 +93,12 @@ class NDView : public ArrayExpr, Ndim> { : buffer_(buffer), strides_(c_strides(shape)), shape_(shape), size_(std::accumulate(std::begin(shape), std::end(shape), 1, std::multiplies<>())) {} + + // stride-aware constructor + NDView(T* buffer, std::array shape, std::array strides) + : buffer_(buffer), shape_(shape), strides_(strides), + size_(std::accumulate(std::begin(shape), std::end(shape), 1, + std::multiplies<>())) {} template std::enable_if_t operator()(Ix... index) {