#ifndef __cxz_for_h__ #define __cxz_for_h__ #include "base/base.h" #include "xpr_base.h" namespace CNORXZ { template class For : public XprInterface> { public: DEFAULT_MEMBERS(For); constexpr For(SizeT size, const IndexId& id, const PosT& step, const Xpr& xpr); template inline SizeT operator()(const PosT1& mlast, const PosT2& last) const; inline SizeT operator()() const; template inline decltype(auto) rootSteps(const IndexId& id) const; private: SizeT mSize = 0; IndexId mId; Xpr mXpr; PosT mStep; // one-dim typedef decltype(mXpr.rootSteps(mId)) XPosT; XPosT mExt; }; // unrolled loop: template class SFor : public XprInterface> { public: DEFAULT_MEMBERS(SFor); constexpr SFor(const IndexId& id, const PosT& step, const Xpr& xpr); template constexpr SizeT operator()(const PosT1& mlast, const PosT2& last) const; constexpr SizeT operator()() const; template constexpr decltype(auto) rootSteps(const IndexId& id) const; private: template constexpr SizeT exec(const PosT1& mlast, const PosT2& last) const; template constexpr SizeT exec() const; IndexId mId; Xpr mXpr; PosT mStep; typedef decltype(mXpr.RootSteps(mId)) XPosT; XPosT mExt; }; // multi-threading template class TFor : public XprInterface> { public: DEFAULT_MEMBERS(TFor); constexpr TFor(SizeT size, const IndexId& id, const PosT& step, const Xpr& xpr); template inline SizeT operator()(const PosT1& mlast, const PosT2& last) const; inline SizeT operator()() const; template inline decltype(auto) rootSteps(const IndexId& id) const; private: SizeT mSize = 0; IndexId mId = 0; Xpr mXpr; PosT mStep; typedef decltype(mXpr.rootSteps(mId)) XPosT; XPosT mExt; }; } #endif