From b2dcf54d658036a858fe6fdcc31df7ec5221ccdf Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Sun, 28 Jul 2024 08:17:19 +0200 Subject: [PATCH] fix UPos/EPos operator+ --- src/include/xpr/pos_type.cc.h | 7 ++++--- src/include/xpr/pos_type.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/include/xpr/pos_type.cc.h b/src/include/xpr/pos_type.cc.h index b1fec7b..1abdf25 100644 --- a/src/include/xpr/pos_type.cc.h +++ b/src/include/xpr/pos_type.cc.h @@ -129,9 +129,10 @@ namespace CNORXZ } template - constexpr UPos UPos::operator+(const PosT& in) const + constexpr decltype(auto) UPos::operator+(const PosT& in) const { if constexpr(is_epos_type::value){ + //return in; return mkEPos::value>(*this,SPos<0>{}) + in; } else { @@ -711,13 +712,13 @@ namespace CNORXZ if constexpr(is_epos_type::value){ return iter<0,sizeof...(OPosTs)> ( [&](auto i) { return std::get(mP)+a.template get(); }, - [&](const auto&... e) { return epos(BPosT::operator+(a),e...); } ); + [&](const auto&... e) { return epos(BPosT::operator+(a.scal()),e...); } ); } else { auto ax = mkEPos(a,a*SPos<0>{}); return iter<0,sizeof...(OPosTs)> ( [&](auto i) { return std::get(mP)+ax.template get(); }, - [&](const auto&... e) { return epos(BPosT::operator+(ax),e...); } ); + [&](const auto&... e) { return epos(BPosT::operator+(a),e...); } ); } } diff --git a/src/include/xpr/pos_type.h b/src/include/xpr/pos_type.h index d9a9a56..ce1eb47 100644 --- a/src/include/xpr/pos_type.h +++ b/src/include/xpr/pos_type.h @@ -63,7 +63,7 @@ namespace CNORXZ constexpr const SizeT& val() const; template - constexpr UPos operator+(const PosT& a) const; + constexpr decltype(auto) operator+(const PosT& a) const; template constexpr UPos operator-(const PosT& a) const;