singkle range: return range size when call by meta data is out of region
This commit is contained in:
parent
6326b32d6a
commit
3f7cbceec9
2 changed files with 26 additions and 13 deletions
|
@ -34,9 +34,11 @@ namespace MultiArrayTools
|
|||
constexpr size_t NEXT = Op::SIZE;
|
||||
const ExtType nxpos = last;
|
||||
const size_t pos = mIndPtr->posAt( mOp.get( nxpos ) );
|
||||
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 ) );
|
||||
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>
|
||||
|
@ -46,9 +48,11 @@ namespace MultiArrayTools
|
|||
constexpr size_t NEXT = Op::SIZE;
|
||||
const ExtType nxpos = last;
|
||||
const size_t pos = mIndPtr->posAt( mOp.get( nxpos ) );
|
||||
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 ));
|
||||
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>
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue