diff --git a/src/include/ranges/xfor/pos_type.cc.h b/src/include/ranges/xfor/pos_type.cc.h index a3cf4d3..34876ed 100644 --- a/src/include/ranges/xfor/pos_type.cc.h +++ b/src/include/ranges/xfor/pos_type.cc.h @@ -238,8 +238,6 @@ namespace CNORXZ { static_assert(is_scalar_pos_type::value, "MPos has to be derived from scalar pos type"); - static_assert(pos_depth::value < MAX_VMPOS_DEPTH, - "preliminary..."); } template @@ -248,8 +246,6 @@ namespace CNORXZ { static_assert(is_scalar_pos_type::value, "MPos has to be derived from scalar pos type"); - static_assert(pos_depth::value < MAX_VMPOS_DEPTH, - "preliminary..."); } template @@ -259,8 +255,6 @@ namespace CNORXZ { static_assert(is_scalar_pos_type::value, "MPos has to be derived from scalar pos type"); - static_assert(pos_depth::value < MAX_VMPOS_DEPTH, - "preliminary..."); } template @@ -270,8 +264,6 @@ namespace CNORXZ { static_assert(is_scalar_pos_type::value, "MPos has to be derived from scalar pos type"); - static_assert(pos_depth::value < MAX_VMPOS_DEPTH, - "preliminary..."); } template @@ -384,7 +376,8 @@ namespace CNORXZ return DPos(mC->vplus( a.vpos() )); } else { - return DPos(mC->vplus( VPosRef(&a) )); + VPosRef b(&a); + return DPos(mC->vplus( &b )); } } @@ -395,7 +388,8 @@ namespace CNORXZ return DPos(mC->vtimes( a.vpos() )); } else { - return DPos(mC->vtimes( VPosRef(&a) )); + VPosRef b(&a); + return DPos(mC->vtimes( &b )); } } @@ -407,7 +401,8 @@ namespace CNORXZ return DPos(mC->vexec( a.vpos() )); } else { - return DPos(mC->vexec( VPosRef(&a) )); + VPosRef b(&a); + return DPos(mC->vexec( &b )); } } diff --git a/src/include/ranges/xfor/vpos_type.cc.h b/src/include/ranges/xfor/vpos_type.cc.h index e4216a8..598c000 100644 --- a/src/include/ranges/xfor/vpos_type.cc.h +++ b/src/include/ranges/xfor/vpos_type.cc.h @@ -156,9 +156,12 @@ namespace CNORXZ template VPos>::VPos(const MPos& a) : MPos(a), - mTRef(static_cast(this)), - mNRef(&this->next()) - {} + mTRef(static_cast(this)) + { + if constexpr(not std::is_same::value){ + mNRef = VPosRef(&this->next()); + } + } template Uptr VPos>::copy() const @@ -198,7 +201,12 @@ namespace CNORXZ template const VPosBase* VPos>::vnext() const { - return &mNRef; + if constexpr(not std::is_same::value){ + return &mNRef; + } + else { + return this->next().get(); + } } template @@ -230,8 +238,10 @@ namespace CNORXZ return std::make_unique>(this->extend(a)); } else { - CXZ_ERROR("preliminary..."); - return nullptr; + typedef decltype(this->extend(DPos(a))) OPosT; + return std::make_unique>(this->extend(DPos(a))); + //CXZ_ERROR("preliminary..."); + //return nullptr; } } @@ -340,9 +350,12 @@ namespace CNORXZ template VPosRef>::VPosRef(const MPos* c) : mC(c), - mTRef(static_cast(mC)), - mNRef(&c->next()) - {} + mTRef(static_cast(mC)) + { + if constexpr(not std::is_same::value){ + mNRef = VPosRef(&c->next()); + } + } template Uptr VPosRef>::copy() const @@ -382,7 +395,12 @@ namespace CNORXZ template const VPosBase* VPosRef>::vnext() const { - return &mNRef; + if constexpr(not std::is_same::value){ + return &mNRef; + } + else { + return mC->next().get(); + } } template @@ -431,6 +449,7 @@ namespace CNORXZ return nullptr; } } + } #endif diff --git a/src/include/ranges/xfor/vpos_type.h b/src/include/ranges/xfor/vpos_type.h index c217ba0..cc33b47 100644 --- a/src/include/ranges/xfor/vpos_type.h +++ b/src/include/ranges/xfor/vpos_type.h @@ -4,7 +4,7 @@ #include "base/base.h" -#define MAX_VMPOS_DEPTH 10 +#define MAX_VMPOS_DEPTH 4 namespace CNORXZ { @@ -107,6 +107,7 @@ namespace CNORXZ }; + template class VPosRef> : public VPosBase {