diff --git a/src/vector.rs b/src/vector.rs index f5987eb..36f3e4b 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -215,6 +215,18 @@ macro_rules! vec( #[inline] fn one() -> $Self { $Self::from_value(one()) } } + impl Index for $Self { + #[inline] + fn index<'a>(&'a self, index: &uint) -> &'a S { + let slice: &[S, ..$n] = unsafe { mem::transmute(self) }; + &slice[*index] + } + } + + impl IndexMut for $Self { + #[inline] fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut S { self.mut_i(*index) } + } + impl ApproxEq for $Self { #[inline] fn approx_eq_eps(&self, other: &$Self, epsilon: &S) -> bool {