include prange + fix corresponding compile errors (untested)

This commit is contained in:
Christian Zimmermann 2023-03-15 11:46:21 +01:00
parent 2d4d0b8ee9
commit 0e1ec2e95a
5 changed files with 24 additions and 14 deletions

View file

@ -164,6 +164,14 @@ namespace CNORXZ
template <typename Meta>
class UIndex;
// definition: ranges/prange.h
template <class Range>
class PRange;
// definition: ranges/prange.h
template <class Index>
class PIndex;
// definition: ranges/crange.h
class CRange; // classic range, trivial meta data

View file

@ -12,9 +12,9 @@ namespace CNORXZ
template <class Index>
PIndex<Index>::PIndex(const RangePtr& range, SizeT pos) :
IndexInterface<Index>(pos),
IndexInterface<Index,typename Index::MetaType>(pos),
mRangePtr(rangeCast<RangeType>(range)),
mIndex(mRangePtr->orig(),mRangePtr->parts()[pos])
mOrig(mRangePtr->orig(),mRangePtr->parts()[pos])
{}
template <class Index>
@ -106,7 +106,7 @@ namespace CNORXZ
}
template <class Index>
Sptr<RangeType> PIndex<Index>::range() const
Sptr<typename PIndex<Index>::RangeType> PIndex<Index>::range() const
{
return mRangePtr;
}
@ -130,13 +130,13 @@ namespace CNORXZ
}
template <class Index>
const MetaT& PIndex<Index>::meta() const
const typename PIndex<Index>::MetaType& PIndex<Index>::meta() const
{
return mOrig->meta();
}
template <class Index>
PIndex& PIndex<Index>::at(const MetaT& metaPos)
PIndex<Index>& PIndex<Index>::at(const MetaType& metaPos)
{
mOrig->at(metaPos);
mkPos();
@ -178,7 +178,7 @@ namespace CNORXZ
template <class Index>
PIndex<Index>& PIndex<Index>::operator()()
{
mkPos()
mkPos();
return *this;
}
@ -201,11 +201,13 @@ namespace CNORXZ
IB::mPos = 0;
for(const auto& x: mRangePtr->parts()){
if(x == opos){
return *this;
return;
}
++IB::mPos;
}
CXZ_ERROR("meta position '" << metaPos << "' not part of range");
CXZ_ERROR("meta position '" << mOrig->meta() << "' not part of range");
}
}
#endif

View file

@ -15,7 +15,7 @@ namespace CNORXZ
{
public:
typedef public IndexInterface<Index,typename Index::MetaType> IB;
typedef IndexInterface<Index,typename Index::MetaType> IB;
typedef PRange<typename Index::RangeType> RangeType;
typedef typename Index::MetaType MetaType;
@ -34,7 +34,7 @@ namespace CNORXZ
UPos lmax() const;
IndexId<0> id() const;
const MetaT& operator*() const;
const MetaType& operator*() const;
SizeT dim() const;
Sptr<RangeType> range() const;
@ -43,8 +43,8 @@ namespace CNORXZ
UPos stepSize(const IndexId<I>& id) const;
String stringMeta() const;
const MetaT& meta() const;
PIndex& at(const MetaT& metaPos);
const MetaType& meta() const;
PIndex& at(const MetaType& metaPos);
decltype(auto) xpr(const Sptr<PIndex<Index>>& _this) const;
template <class I>

View file

@ -5,6 +5,7 @@
#include "xindex.cc.h"
#include "urange.cc.h"
#include "crange.cc.h"
#include "prange.cc.h"
#include "dindex.cc.h"
#include "lindex.cc.h"
#include "index_mul.cc.h"

View file

@ -3,8 +3,7 @@
#include "index_base.h"
#include "mrange.h"
#include "crange.h"
//#include "subrange.h"
//#include "value_range.h"
#include "prange.h"
#include "xindex.h"
#include "yrange.h"
#include "dindex.h"