vectors: min, max
This commit is contained in:
parent
4ce5c045a8
commit
2d87e4b5cc
@ -166,6 +166,19 @@ macro_rules! impl_vector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Ord> $struct<T> {
|
||||||
|
pub fn min(self, rhs: Self) -> $struct<T> {
|
||||||
|
$struct{
|
||||||
|
$( $field: self.$field.min(rhs.$field) ), +
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn max(self, rhs: Self) -> $struct<T> {
|
||||||
|
$struct{
|
||||||
|
$( $field: self.$field.max(rhs.$field) ), +
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: core::ops::Neg<Output = T>> core::ops::Neg for $struct<T> {
|
impl<T: core::ops::Neg<Output = T>> core::ops::Neg for $struct<T> {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user