singkle range: return range size when call by meta data is out of region

This commit is contained in:
Christian Zimmermann 2019-04-04 19:28:45 +02:00
parent 6326b32d6a
commit 3f7cbceec9
2 changed files with 26 additions and 13 deletions

View file

@ -34,10 +34,12 @@ namespace MultiArrayTools
constexpr size_t NEXT = Op::SIZE;
const ExtType nxpos = last;
const size_t pos = mIndPtr->posAt( mOp.get( nxpos ) );
if(pos != mIndPtr->max()){
const ExtType npos = last + mExt*pos;
const size_t mnpos = PosForward<ForType::DEFAULT>::valuex(mlast, mStep, pos);
mExpr(mnpos, Getter<NEXT>::template getX<ExtType>( npos ) );
}
}
template <class Op, class Index, class Expr, SpaceType STYPE>
inline void OpExpr<Op,Index,Expr,STYPE>::operator()(size_t mlast)
@ -46,10 +48,12 @@ namespace MultiArrayTools
constexpr size_t NEXT = Op::SIZE;
const ExtType nxpos = last;
const size_t pos = mIndPtr->posAt( mOp.get( nxpos ) );
if(pos != mIndPtr->max()){
const ExtType npos = last + mExt*pos;
const size_t mnpos = PosForward<ForType::DEFAULT>::valuex(mlast, mStep, pos);
mExpr(mnpos, Getter<NEXT>::template getX<ExtType>( npos ));
}
}
template <class Op, class Index, class Expr, SpaceType STYPE>
auto OpExpr<Op,Index,Expr,STYPE>::rootSteps(std::intptr_t iPtrNum) const

View file

@ -132,7 +132,16 @@ namespace MultiArrayTools
}
}
size_t at(const U& in) const { return mMap.at(in); }
size_t at(const U& in) const
{
auto x = mMap.find(in);
if(x != mMap.end()){
return x->second;
}
else {
return mMap.size();
}
}
size_t count(const U& in) const { return mMap.count(in); }
};
@ -540,12 +549,6 @@ namespace MultiArrayTools
return mSpace[pos];
}
template <typename U, SpaceType TYPE, size_t S>
size_t GenSingleRange<U,TYPE,S>::getMeta(const U& metaPos) const
{
return mMSpace.at(metaPos);
}
template <size_t SIZE>
inline size_t getStatSizeOrDyn(size_t size)
{
@ -558,6 +561,12 @@ namespace MultiArrayTools
return size;
}
template <typename U, SpaceType TYPE, size_t S>
size_t GenSingleRange<U,TYPE,S>::getMeta(const U& metaPos) const
{
return mMSpace.at(metaPos);
}
template <typename U, SpaceType TYPE, size_t S>
size_t GenSingleRange<U,TYPE,S>::size() const
{