From dfa6a16dcbfe1b98e1890b8ea38f9c85a2346536 Mon Sep 17 00:00:00 2001 From: Joel Falcou Date: Mon, 13 Oct 2025 19:48:55 +0200 Subject: [PATCH] Fix ref<> behavior on storage order See merge request oss/rotgen!39 --- include/rotgen/container/ref.hpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/include/rotgen/container/ref.hpp b/include/rotgen/container/ref.hpp index 53503f3..5c4b409 100644 --- a/include/rotgen/container/ref.hpp +++ b/include/rotgen/container/ref.hpp @@ -80,27 +80,22 @@ namespace rotgen template S, int R, int C, int O, int MR, int MC> ref(matrix& m) : parent(m.data(), m.rows(), m.cols(), strides(m)) - { - static_assert((O & 1) == storage_order, "ref: Incompatible storage layout"); - } + {} template + requires(std::same_as && (Ref::storage_order & 1) == storage_order) ref(block&& b) : parent(b.data(), b.rows(), b.cols(), stride_type{b.outerStride(),b.innerStride()}) - { - static_assert((Ref::storage_order & 1) == storage_order, "ref: Incompatible storage layout"); - } + {} template + requires(std::same_as && (Ref::storage_order & 1) == storage_order) ref(block& b) : parent(b.data(), b.rows(), b.cols(), stride_type{b.outerStride(),b.innerStride()}) - { - static_assert((Ref::storage_order & 1) == storage_order, "ref: Incompatible storage layout"); - } + {} template + requires(std::same_as && (Ref::storage_order & 1) == storage_order) ref(map& b) : parent(b.data(), b.rows(), b.cols(), stride_type{b.outerStride(),b.innerStride()}) - { - static_assert((Ref::storage_order & 1) == storage_order, "ref: Incompatible storage layout"); - } + {} template ref ( ref& b ) @@ -180,7 +175,6 @@ namespace rotgen template S, int R, int C, int O, int MR, int MC> ref(matrix const& m) - requires((O & 1) == storage_order) : parent(m.data(), m.rows(), m.cols(), strides(m)) {}