cnorxz/src/include/ranges/xpr/xpr_base.cc.h

70 lines
1.3 KiB
C
Raw Normal View History

2022-10-13 19:12:23 +02:00
#ifndef __cxz_xpr_base_cc_h__
#define __cxz_xpr_base_cc_h__
#include "xpr_base.h"
namespace CNORXZ
{
/************
* VXpr *
************/
template <class Xpr>
VXpr<Xpr>::VXpr(const XprInterface<Xpr>& a) :
Xpr(a.THIS())
{}
template <class Xpr>
Uptr<VXprBase> VXpr<Xpr>::copy() const
{
return std::make_unique<VXpr<Xpr>>(*this);
}
template <class Xpr>
2022-10-16 00:55:14 +02:00
SizeT VXpr<Xpr>::vexec(const UPos& mlast, const DPos& last) const
2022-10-13 19:12:23 +02:00
{
return (*this)(mlast, last);
}
template <class Xpr>
2022-10-16 00:55:14 +02:00
SizeT VXpr<Xpr>::vexec() const
2022-10-13 19:12:23 +02:00
{
2022-10-16 00:55:14 +02:00
return (*this)();
2022-10-13 19:12:23 +02:00
}
template <class Xpr>
2022-10-16 18:37:14 +02:00
DPos VXpr<Xpr>::vrootSteps(const IndexId<0>& id) const
2022-10-13 19:12:23 +02:00
{
2022-10-16 23:05:48 +02:00
return DPos(this->rootSteps(id));
2022-10-13 19:12:23 +02:00
}
/************
* DXpr *
************/
template <class Xpr>
2022-10-16 23:05:48 +02:00
DXpr::DXpr(const Xpr& a) :
ObjHandle<VXprBase>(std::make_unique<VXpr<Xpr>>(a))
2022-10-13 19:12:23 +02:00
{}
2022-10-16 23:05:48 +02:00
inline SizeT DXpr::operator()(const UPos& mlast, const DPos& last) const
2022-10-13 19:12:23 +02:00
{
2022-10-16 23:05:48 +02:00
return mC->vexec(mlast, last);
2022-10-13 19:12:23 +02:00
}
2022-10-16 00:55:14 +02:00
inline SizeT DXpr::operator()() const
2022-10-13 19:12:23 +02:00
{
2022-10-16 00:55:14 +02:00
return mC->vexec();
2022-10-13 19:12:23 +02:00
}
2022-10-16 18:37:14 +02:00
template <SizeT I>
inline DPos DXpr::rootSteps(const IndexId<I>& id) const
2022-10-13 19:12:23 +02:00
{
2022-10-16 23:05:48 +02:00
return mC->vrootSteps(IndexId<0>(id.id()));
2022-10-13 19:12:23 +02:00
}
}
#endif