Add util::spatial_array::size,min,max
This commit is contained in:
parent
b3304e7785
commit
f39cc15bd8
1 changed files with 22 additions and 0 deletions
|
|
@ -40,6 +40,10 @@ namespace psemek::util
|
||||||
T const * begin() const;
|
T const * begin() const;
|
||||||
T const * end() const;
|
T const * end() const;
|
||||||
|
|
||||||
|
Index size(std::size_t dimension) const;
|
||||||
|
Index min(std::size_t dimension) const;
|
||||||
|
Index max(std::size_t dimension) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Index origin_[N];
|
Index origin_[N];
|
||||||
array<T, N> array_;
|
array<T, N> array_;
|
||||||
|
|
@ -217,4 +221,22 @@ namespace psemek::util
|
||||||
return array_.end();
|
return array_.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N, typename Index>
|
||||||
|
Index spatial_array<T, N, Index>::size(std::size_t dimension) const
|
||||||
|
{
|
||||||
|
return static_cast<Index>(array_.dim(dimension));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N, typename Index>
|
||||||
|
Index spatial_array<T, N, Index>::min(std::size_t dimension) const
|
||||||
|
{
|
||||||
|
return origin_[dimension];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N, typename Index>
|
||||||
|
Index spatial_array<T, N, Index>::max(std::size_t dimension) const
|
||||||
|
{
|
||||||
|
return origin_[dimension] + static_cast<Index>(array_.dim(dimension));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue