diff --git a/fixed_wide_vectors/src/macros/vector.rs b/fixed_wide_vectors/src/macros/vector.rs index 2596138..d8766be 100644 --- a/fixed_wide_vectors/src/macros/vector.rs +++ b/fixed_wide_vectors/src/macros/vector.rs @@ -130,24 +130,36 @@ macro_rules! impl_vector { #[macro_export(local_inner_macros)] macro_rules! impl_vector_operator { ($trait: ident, $method: ident ) => { - impl,U,V> core::ops::$trait> for Vector{ - type Output=Vector; - fn $method(self,rhs:Vector)->Self::Output{ + impl> core::ops::$trait for Vector{ + type Output=Self; + fn $method(self,rhs:Self)->Self::Output{ self.map_zip(rhs,|(a,b)|a.$method(b)) } } + impl+Copy> core::ops::$trait for Vector{ + type Output=Self; + fn $method(self,rhs:T)->Self::Output{ + self.map(|t|t.$method(rhs)) + } + } } } #[doc(hidden)] #[macro_export(local_inner_macros)] macro_rules! impl_vector_assign_operator { ($trait: ident, $method: ident ) => { - impl,U> core::ops::$trait> for Vector{ - fn $method(&mut self,rhs:Vector){ + impl core::ops::$trait for Vector{ + fn $method(&mut self,rhs:Self){ self.array.iter_mut().zip(rhs.array) .for_each(|(a,b)|a.$method(b)) } } + impl core::ops::$trait for Vector{ + fn $method(&mut self,rhs:T){ + self.array.iter_mut() + .for_each(|t|t.$method(rhs)) + } + } } }