From 8c351139671215438d43e154ac1acfd5884bfb28 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Tue, 9 Jul 2024 19:29:23 +0200 Subject: [PATCH] fix sindex step size --- src/include/ranges/srange.cc.h | 9 +++++++-- src/include/ranges/srange.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/include/ranges/srange.cc.h b/src/include/ranges/srange.cc.h index 7c9dfde..8a6a33f 100644 --- a/src/include/ranges/srange.cc.h +++ b/src/include/ranges/srange.cc.h @@ -128,9 +128,14 @@ namespace CNORXZ template template - UPos SIndex::stepSize(const IndexId& id) const + decltype(auto) SIndex::stepSize(const IndexId& id) const { - return UPos(id == this->id() ? 1 : 0); + if constexpr(I != 0){ + return SPos<0>(); + } + else { + return UPos(id == this->id() ? 1 : 0); + } } template diff --git a/src/include/ranges/srange.h b/src/include/ranges/srange.h index 5cf1661..dc7598f 100644 --- a/src/include/ranges/srange.h +++ b/src/include/ranges/srange.h @@ -88,7 +88,7 @@ namespace CNORXZ /** @copydoc IndexInterface::stepSize() */ template - UPos stepSize(const IndexId& id) const; + decltype(auto) stepSize(const IndexId& id) const; /** @copydoc IndexInterface::stringMeta() */ String stringMeta() const;