use std::ops::Add;
pub trait Zero: Add<Output = Self> + Sized {
fn zero() -> Self;
}
pub trait AddAssoc: Add<Output = Self> + Sized {}
pub trait AddComm: Add<Output = Self> + Sized {}
macro_rules! impl_trait {
(
$( impl ($T:ty) for { $( $U:ty ),* } $S:tt )*
) => {
$( $( impl $T for $U $S )* )*
};
}
impl_trait! {
impl (Zero) for {i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize} {
fn zero() -> Self { 0 }
}
impl (AddAssoc) for {i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize} {}
impl (AddComm) for {i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize} {}
}