Implemented `SliceRange` for `RangeInclusive`
use std::marker::PhantomData;
-use std::ops::{Range, RangeFrom, RangeFull, RangeTo};
+use std::ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeTo};
use std::slice;
use crate::base::allocator::Allocator;
@@ -806,6 +806,25 @@ impl<D: Dim> SliceRange<D> for RangeFull {
}
}
+impl<D: Dim> SliceRange<D> for RangeInclusive<usize> {
+ type Size = Dynamic;
+
+ #[inline(always)]
+ fn begin(&self, _: D) -> usize {
+ *self.start()
+ }
+
+ #[inline(always)]
+ fn end(&self, _: D) -> usize {
+ *self.end() + 1
+ }
+
+ #[inline(always)]
+ fn size(&self, _: D) -> Self::Size {
+ Dynamic::new(*self.end() + 1 - *self.start())
+ }
+}
+
// TODO: see how much of this overlaps with the general indexing
// methods from indexing.rs.
impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
