use std::ops::Index;
use crate::arr::{core::Shape, vec::core::ArrVec};
impl<T> Index<&Vec<usize>> for ArrVec<T> {
type Output = T;
fn index(&self, index: &Vec<usize>) -> &Self::Output {
let abs_index = self.plain_index(index);
&self.buff[abs_index]
}
}
impl<T> Index<Vec<usize>> for ArrVec<T> {
type Output = T;
fn index(&self, index: Vec<usize>) -> &Self::Output {
self.index(&index)
}
}
impl<T> Index<&[usize]> for ArrVec<T> {
type Output = T;
fn index(&self, index: &[usize]) -> &Self::Output {
self.index(Vec::from(index))
}
}
impl<T, const N: usize> Index<[usize; N]> for ArrVec<T> {
type Output = T;
fn index(&self, index: [usize; N]) -> &Self::Output {
self.index(Vec::from(index))
}
}