must be less generic to avoid conflict with convenience operators
This commit is contained in:
parent
a0da6873c1
commit
5cdd2c3ee1
@ -130,24 +130,36 @@ macro_rules! impl_vector {
|
||||
#[macro_export(local_inner_macros)]
|
||||
macro_rules! impl_vector_operator {
|
||||
($trait: ident, $method: ident ) => {
|
||||
impl<const N:usize,T:core::ops::$trait<U,Output=V>,U,V> core::ops::$trait<Vector<N,U>> for Vector<N,T>{
|
||||
type Output=Vector<N,V>;
|
||||
fn $method(self,rhs:Vector<N,U>)->Self::Output{
|
||||
impl<const N:usize,T:core::ops::$trait<Output=T>> core::ops::$trait for Vector<N,T>{
|
||||
type Output=Self;
|
||||
fn $method(self,rhs:Self)->Self::Output{
|
||||
self.map_zip(rhs,|(a,b)|a.$method(b))
|
||||
}
|
||||
}
|
||||
impl<const N:usize,T:core::ops::$trait<Output=T>+Copy> core::ops::$trait<T> for Vector<N,T>{
|
||||
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<const N:usize,T:core::ops::$trait<U>,U> core::ops::$trait<Vector<N,U>> for Vector<N,T>{
|
||||
fn $method(&mut self,rhs:Vector<N,U>){
|
||||
impl<const N:usize,T:core::ops::$trait> core::ops::$trait for Vector<N,T>{
|
||||
fn $method(&mut self,rhs:Self){
|
||||
self.array.iter_mut().zip(rhs.array)
|
||||
.for_each(|(a,b)|a.$method(b))
|
||||
}
|
||||
}
|
||||
impl<const N:usize,T:core::ops::$trait+Copy> core::ops::$trait<T> for Vector<N,T>{
|
||||
fn $method(&mut self,rhs:T){
|
||||
self.array.iter_mut()
|
||||
.for_each(|t|t.$method(rhs))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user