Closed achilleas-k closed 5 years ago
I think that is implicitly done (DataView.hpp
):
if (this->offset + this->count > array.dataExtent()) {
throw OutOfBounds("Trying to create DataView which is out of bounds");
}
Because comparing the NDSize
(offset + count
) with dataExtent()
will check the dimensionality:
template<typename T>
inline bool NDSize::operator<(const NDSizeBase<T> &lhs, const NDSizeBase<T> &rhs)
{
if (lhs.size() != rhs.size()) {
throw IncompatibleDimensions("size must agree to compare",
"NDSizeBase < NDSizeBase ");
}
You're right. Didn't think to check that. Would you like to add an explicit check? If you think the check in the comparison is enough, just close the issue.
Would you like to add an explicit check? If you think the check in the comparison is enough, just close the issue.
I think that would be better, yeah, an IncompatibleDimensions
with a more specific error message.
I could be wrong but I think we don't check the dimensionality of
offset
andcount
when creating DataView objects. DataViews are only created internally (users aren't expected to create them manually), so this is probably not strictly necessary, but might be a good bug catcher.