range base: add savesub function
This commit is contained in:
parent
41e206f5aa
commit
215c2c4f55
2 changed files with 15 additions and 0 deletions
|
@ -106,6 +106,12 @@ namespace CNORXZ
|
|||
*/
|
||||
virtual RangePtr sub(SizeT num) const;
|
||||
|
||||
/** Access sub-ranges.
|
||||
Same as sub(), but performs domain and memory safety checks.
|
||||
@param num size type argument
|
||||
*/
|
||||
virtual RangePtr savesub(SizeT num) const;
|
||||
|
||||
/** Access sub-ranges.
|
||||
In the case the range is multi-dimensional this function returns an
|
||||
array of all sub-ranges (empty is one-dimensional)
|
||||
|
|
|
@ -70,6 +70,15 @@ namespace CNORXZ
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RangePtr RangeBase::savesub(SizeT num) const
|
||||
{
|
||||
CXZ_ASSERT(num < dim(), "sub-range position = " << num
|
||||
<< " exceeds range dimension = " << dim());
|
||||
RangePtr o = sub(num);
|
||||
CXZ_ASSERT(o != nullptr, "no sub-range at position = " << num);
|
||||
return o;
|
||||
}
|
||||
|
||||
MArray<RangePtr> RangeBase::sub() const
|
||||
{
|
||||
return MArray<RangePtr>();
|
||||
|
|
Loading…
Reference in a new issue