fix UPos/EPos operator+

This commit is contained in:
Christian Zimmermann 2024-07-28 08:17:19 +02:00
parent 88c40d702a
commit b2dcf54d65
2 changed files with 5 additions and 4 deletions

View file

@ -129,9 +129,10 @@ namespace CNORXZ
}
template <class PosT>
constexpr UPos UPos::operator+(const PosT& in) const
constexpr decltype(auto) UPos::operator+(const PosT& in) const
{
if constexpr(is_epos_type<PosT>::value){
//return in;
return mkEPos<epos_size<PosT>::value>(*this,SPos<0>{}) + in;
}
else {
@ -711,13 +712,13 @@ namespace CNORXZ
if constexpr(is_epos_type<PosT>::value){
return iter<0,sizeof...(OPosTs)>
( [&](auto i) { return std::get<i>(mP)+a.template get<i>(); },
[&](const auto&... e) { return epos(BPosT::operator+(a),e...); } );
[&](const auto&... e) { return epos(BPosT::operator+(a.scal()),e...); } );
}
else {
auto ax = mkEPos<sizeof...(OPosTs)>(a,a*SPos<0>{});
return iter<0,sizeof...(OPosTs)>
( [&](auto i) { return std::get<i>(mP)+ax.template get<i>(); },
[&](const auto&... e) { return epos(BPosT::operator+(ax),e...); } );
[&](const auto&... e) { return epos(BPosT::operator+(a),e...); } );
}
}

View file

@ -63,7 +63,7 @@ namespace CNORXZ
constexpr const SizeT& val() const;
template <class PosT>
constexpr UPos operator+(const PosT& a) const;
constexpr decltype(auto) operator+(const PosT& a) const;
template <class PosT>
constexpr UPos operator-(const PosT& a) const;