From 026c7f1a87474529d25ea493cc32a91b7b6cc471 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Sun, 19 Mar 2023 01:48:51 +0100 Subject: [PATCH] add missing operator* for GMIndex + fix various bugs --- src/include/operation/op_types.h | 6 +++++- src/include/ranges/mrange.cc.h | 8 +++++++- src/include/ranges/mrange.h | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/include/operation/op_types.h b/src/include/operation/op_types.h index 1203024..548081e 100644 --- a/src/include/operation/op_types.h +++ b/src/include/operation/op_types.h @@ -214,7 +214,7 @@ namespace CNORXZ template struct op_size> - { static constexpr SizeT value = sizeof...(Ops); }; + { static constexpr SizeT value = ( op_size::value + ... ); }; template class Contraction : public OpInterface> @@ -238,6 +238,10 @@ namespace CNORXZ CXpr mCXpr; }; + template + struct op_size> + { static constexpr SizeT value = op_size::value; }; + template constexpr decltype(auto) contraction(F&& f, Op&& op, const Sptr& i); diff --git a/src/include/ranges/mrange.cc.h b/src/include/ranges/mrange.cc.h index af19563..396d30b 100644 --- a/src/include/ranges/mrange.cc.h +++ b/src/include/ranges/mrange.cc.h @@ -254,7 +254,7 @@ namespace CNORXZ } if constexpr(not std::is_same::value){ mLex = lexpos; } IB::mPos = iter<0,NI>( [&](auto i) { - *mIPack[i] = (lex() / lexFormat()[i].val()) % mIPack[i]->lmax().val(); + *mIPack[i] = (lexpos / lexFormat()[i].val()) % mIPack[i]->lmax().val(); return format()[i].val() * mIPack[i]->pos(); }, [](const auto&... e) { return (e + ...); } ); return *this; @@ -510,6 +510,12 @@ namespace CNORXZ return std::make_shared>(bs, is...); } + template + decltype(auto) operator*(const Sptr>& a, const Sptr& b) + { + return iptrMul(a, b); + } + /********************* * MRangeFactory * *********************/ diff --git a/src/include/ranges/mrange.h b/src/include/ranges/mrange.h index ec7a831..a4b1f2e 100644 --- a/src/include/ranges/mrange.h +++ b/src/include/ranges/mrange.h @@ -148,6 +148,9 @@ namespace CNORXZ template constexpr decltype(auto) gmindexPtr(const FormatT& bs, const Sptr&... is); + template + decltype(auto) operator*(const Sptr>& a, const Sptr& b); + template class MRangeFactory : public RangeFactoryBase {