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

84 lines
1.6 KiB
C
Raw Normal View History

2024-02-03 22:02:01 +01:00
// -*- C++ -*-
/**
@file include/xpr/xpr_base.cc.h
@brief Xpression base template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
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 |
+==========*/
2022-10-13 19:12:23 +02:00
template <typename T, class Xpr>
VXpr<T,Xpr>::VXpr(const XprInterface<Xpr>& a) :
2022-10-13 19:12:23 +02:00
Xpr(a.THIS())
{}
template <typename T, class Xpr>
Uptr<VXprBase<T>> VXpr<T,Xpr>::copy() const
2022-10-13 19:12:23 +02:00
{
return std::make_unique<VXpr<T,Xpr>>(*this);
2022-10-13 19:12:23 +02:00
}
template <typename T, class Xpr>
T VXpr<T,Xpr>::vexec(const DPos& last) const
2022-10-13 19:12:23 +02:00
{
2023-11-19 19:17:55 +01:00
return (*this)(last);
2022-10-13 19:12:23 +02:00
}
template <typename T, class Xpr>
T VXpr<T,Xpr>::vexec() const
2022-10-13 19:12:23 +02:00
{
return (*this)();
2022-10-13 19:12:23 +02:00
}
template <typename T, class Xpr>
DPos VXpr<T,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 |
+==========*/
2022-10-13 19:12:23 +02:00
template <typename T>
2022-10-13 19:12:23 +02:00
template <class Xpr>
DXpr<T>::DXpr(const Xpr& a) :
ObjHandle<VXprBase<T>>(std::make_unique<VXpr<T,Xpr>>(a))
2022-10-13 19:12:23 +02:00
{}
template <typename T>
inline T DXpr<T>::operator()(const DPos& last) const
2022-10-13 19:12:23 +02:00
{
return VB::mC->vexec(last);
2022-10-13 19:12:23 +02:00
}
template <typename T>
inline T DXpr<T>::operator()() const
2022-10-13 19:12:23 +02:00
{
return VB::mC->vexec();
2022-10-13 19:12:23 +02:00
}
template <typename T>
2022-10-16 18:37:14 +02:00
template <SizeT I>
inline DPos DXpr<T>::rootSteps(const IndexId<I>& id) const
2022-10-13 19:12:23 +02:00
{
return VB::mC->vrootSteps(IndexId<0>(id.id()));
2022-10-13 19:12:23 +02:00
}
}
#endif