This commit is contained in:
Christian Zimmermann 2022-10-13 00:30:37 +02:00
parent c7e66f081c
commit d804f5db7e
3 changed files with 37 additions and 22 deletions

View file

@ -238,8 +238,6 @@ namespace CNORXZ
{
static_assert(is_scalar_pos_type<BPosT>::value,
"MPos has to be derived from scalar pos type");
static_assert(pos_depth<NPosT>::value < MAX_VMPOS_DEPTH,
"preliminary...");
}
template <class BPosT, class NPosT>
@ -248,8 +246,6 @@ namespace CNORXZ
{
static_assert(is_scalar_pos_type<BPosT>::value,
"MPos has to be derived from scalar pos type");
static_assert(pos_depth<NPosT>::value < MAX_VMPOS_DEPTH,
"preliminary...");
}
template <class BPosT, class NPosT>
@ -259,8 +255,6 @@ namespace CNORXZ
{
static_assert(is_scalar_pos_type<BPosT>::value,
"MPos has to be derived from scalar pos type");
static_assert(pos_depth<NPosT>::value < MAX_VMPOS_DEPTH,
"preliminary...");
}
template <class BPosT, class NPosT>
@ -270,8 +264,6 @@ namespace CNORXZ
{
static_assert(is_scalar_pos_type<BPosT>::value,
"MPos has to be derived from scalar pos type");
static_assert(pos_depth<NPosT>::value < MAX_VMPOS_DEPTH,
"preliminary...");
}
template <class BPosT, class NPosT>
@ -384,7 +376,8 @@ namespace CNORXZ
return DPos(mC->vplus( a.vpos() ));
}
else {
return DPos(mC->vplus( VPosRef<PosT>(&a) ));
VPosRef<PosT> 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<PosT>(&a) ));
VPosRef<PosT> 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<PosT>(&a) ));
VPosRef<PosT> b(&a);
return DPos(mC->vexec( &b ));
}
}

View file

@ -156,9 +156,12 @@ namespace CNORXZ
template <class PosT1, class PosT2>
VPos<MPos<PosT1,PosT2>>::VPos(const MPos<PosT1,PosT2>& a) :
MPos<PosT1,PosT2>(a),
mTRef(static_cast<const PosT1*>(this)),
mNRef(&this->next())
{}
mTRef(static_cast<const PosT1*>(this))
{
if constexpr(not std::is_same<PosT2,DPos>::value){
mNRef = VPosRef<PosT2>(&this->next());
}
}
template <class PosT1, class PosT2>
Uptr<VPosBase> VPos<MPos<PosT1,PosT2>>::copy() const
@ -198,7 +201,12 @@ namespace CNORXZ
template <class PosT1, class PosT2>
const VPosBase* VPos<MPos<PosT1,PosT2>>::vnext() const
{
return &mNRef;
if constexpr(not std::is_same<PosT2,DPos>::value){
return &mNRef;
}
else {
return this->next().get();
}
}
template <class PosT1, class PosT2>
@ -230,8 +238,10 @@ namespace CNORXZ
return std::make_unique<VPos<OPosT>>(this->extend(a));
}
else {
CXZ_ERROR("preliminary...");
return nullptr;
typedef decltype(this->extend(DPos(a))) OPosT;
return std::make_unique<VPos<OPosT>>(this->extend(DPos(a)));
//CXZ_ERROR("preliminary...");
//return nullptr;
}
}
@ -340,9 +350,12 @@ namespace CNORXZ
template <class PosT1, class PosT2>
VPosRef<MPos<PosT1,PosT2>>::VPosRef(const MPos<PosT1,PosT2>* c) :
mC(c),
mTRef(static_cast<const PosT1*>(mC)),
mNRef(&c->next())
{}
mTRef(static_cast<const PosT1*>(mC))
{
if constexpr(not std::is_same<PosT2,DPos>::value){
mNRef = VPosRef<PosT2>(&c->next());
}
}
template <class PosT1, class PosT2>
Uptr<VPosBase> VPosRef<MPos<PosT1,PosT2>>::copy() const
@ -382,7 +395,12 @@ namespace CNORXZ
template <class PosT1, class PosT2>
const VPosBase* VPosRef<MPos<PosT1,PosT2>>::vnext() const
{
return &mNRef;
if constexpr(not std::is_same<PosT2,DPos>::value){
return &mNRef;
}
else {
return mC->next().get();
}
}
template <class PosT1, class PosT2>
@ -431,6 +449,7 @@ namespace CNORXZ
return nullptr;
}
}
}
#endif

View file

@ -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 PosT1, class PosT2>
class VPosRef<MPos<PosT1,PosT2>> : public VPosBase
{