Skip to content

Instantly share code, notes, and snippets.

@ExpHP
Created December 12, 2017 21:04
Show Gist options
  • Select an option

  • Save ExpHP/1a23bb24b1fe1bc1e178e3236ce6a734 to your computer and use it in GitHub Desktop.

Select an option

Save ExpHP/1a23bb24b1fe1bc1e178e3236ce6a734 to your computer and use it in GitHub Desktop.
use ::std::ops::{Add, Sub, Neg};
pub trait AddSub1
: Sized
+ Add<<Self as AddSub1>::NThrice, Output=<Self as AddSub1>::NTwice>
+ Sub<<Self as AddSub1>::NThrice>
+ Add<<Self as AddSub1>::NTwice, Output=<Self as AddSub1>::Neg>
+ Sub<<Self as AddSub1>::NTwice, Output=<Self as AddSub1>::Thrice>
+ Add<<Self as AddSub1>::Neg, Output=<Self as AddSub1>::Zero>
+ Sub<<Self as AddSub1>::Neg, Output=<Self as AddSub1>::Twice>
+ Add<<Self as AddSub1>::Zero, Output=Self>
+ Sub<<Self as AddSub1>::Zero, Output=Self>
+ Add<<Self as AddSub1>::Twice, Output=<Self as AddSub1>::Thrice>
+ Sub<<Self as AddSub1>::Twice, Output=<Self as AddSub1>::Neg>
+ Add<<Self as AddSub1>::Thrice>
+ Sub<<Self as AddSub1>::Thrice, Output=<Self as AddSub1>::NTwice>
{
type NThrice
: Add<<Self as AddSub1>::NThrice>
+ Sub<<Self as AddSub1>::NThrice, Output=<Self as AddSub1>::Zero>
+ Add<<Self as AddSub1>::NTwice>
+ Sub<<Self as AddSub1>::NTwice, Output=<Self as AddSub1>::Neg>
+ Add<<Self as AddSub1>::Neg>
+ Sub<<Self as AddSub1>::Neg, Output=<Self as AddSub1>::NTwice>
+ Add<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::NThrice>
+ Sub<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::NThrice>
+ Add<Self, Output=<Self as AddSub1>::NTwice>
+ Sub<Self>
+ Add<<Self as AddSub1>::Twice, Output=<Self as AddSub1>::Neg>
+ Sub<<Self as AddSub1>::Twice>
+ Add<<Self as AddSub1>::Thrice, Output=<Self as AddSub1>::Zero>
+ Sub<<Self as AddSub1>::Thrice>
;
type NTwice
: Add<<Self as AddSub1>::NThrice>
+ Sub<<Self as AddSub1>::NThrice, Output=Self>
+ Add<<Self as AddSub1>::NTwice>
+ Sub<<Self as AddSub1>::NTwice, Output=<Self as AddSub1>::Zero>
+ Add<<Self as AddSub1>::Neg, Output=<Self as AddSub1>::NThrice>
+ Sub<<Self as AddSub1>::Neg, Output=<Self as AddSub1>::Neg>
+ Add<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::NTwice>
+ Sub<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::NTwice>
+ Add<Self, Output=<Self as AddSub1>::Neg>
+ Sub<Self, Output=<Self as AddSub1>::NThrice>
+ Add<<Self as AddSub1>::Twice, Output=<Self as AddSub1>::Zero>
+ Sub<<Self as AddSub1>::Twice>
+ Add<<Self as AddSub1>::Thrice, Output=Self>
+ Sub<<Self as AddSub1>::Thrice>
;
type Neg
: Add<<Self as AddSub1>::NThrice>
+ Sub<<Self as AddSub1>::NThrice, Output=<Self as AddSub1>::Twice>
+ Add<<Self as AddSub1>::NTwice, Output=<Self as AddSub1>::NThrice>
+ Sub<<Self as AddSub1>::NTwice, Output=Self>
+ Add<<Self as AddSub1>::Neg, Output=<Self as AddSub1>::NTwice>
+ Sub<<Self as AddSub1>::Neg, Output=<Self as AddSub1>::Zero>
+ Add<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::Neg>
+ Sub<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::Neg>
+ Add<Self, Output=<Self as AddSub1>::Zero>
+ Sub<Self, Output=<Self as AddSub1>::NTwice>
+ Add<<Self as AddSub1>::Twice, Output=Self>
+ Sub<<Self as AddSub1>::Twice, Output=<Self as AddSub1>::NThrice>
+ Add<<Self as AddSub1>::Thrice, Output=<Self as AddSub1>::Twice>
+ Sub<<Self as AddSub1>::Thrice>
;
type Zero
: Add<<Self as AddSub1>::NThrice, Output=<Self as AddSub1>::NThrice>
+ Sub<<Self as AddSub1>::NThrice, Output=<Self as AddSub1>::Thrice>
+ Add<<Self as AddSub1>::NTwice, Output=<Self as AddSub1>::NTwice>
+ Sub<<Self as AddSub1>::NTwice, Output=<Self as AddSub1>::Twice>
+ Add<<Self as AddSub1>::Neg, Output=<Self as AddSub1>::Neg>
+ Sub<<Self as AddSub1>::Neg, Output=Self>
+ Add<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::Zero>
+ Sub<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::Zero>
+ Add<Self, Output=Self>
+ Sub<Self, Output=<Self as AddSub1>::Neg>
+ Add<<Self as AddSub1>::Twice, Output=<Self as AddSub1>::Twice>
+ Sub<<Self as AddSub1>::Twice, Output=<Self as AddSub1>::NTwice>
+ Add<<Self as AddSub1>::Thrice, Output=<Self as AddSub1>::Thrice>
+ Sub<<Self as AddSub1>::Thrice, Output=<Self as AddSub1>::NThrice>
;
type Twice
: Add<<Self as AddSub1>::NThrice, Output=<Self as AddSub1>::Neg>
+ Sub<<Self as AddSub1>::NThrice>
+ Add<<Self as AddSub1>::NTwice, Output=<Self as AddSub1>::Zero>
+ Sub<<Self as AddSub1>::NTwice>
+ Add<<Self as AddSub1>::Neg, Output=Self>
+ Sub<<Self as AddSub1>::Neg, Output=<Self as AddSub1>::Thrice>
+ Add<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::Twice>
+ Sub<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::Twice>
+ Add<Self, Output=<Self as AddSub1>::Thrice>
+ Sub<Self, Output=Self>
+ Add<<Self as AddSub1>::Twice>
+ Sub<<Self as AddSub1>::Twice, Output=<Self as AddSub1>::Zero>
+ Add<<Self as AddSub1>::Thrice>
+ Sub<<Self as AddSub1>::Thrice, Output=<Self as AddSub1>::Neg>
;
type Thrice
: Add<<Self as AddSub1>::NThrice, Output=<Self as AddSub1>::Zero>
+ Sub<<Self as AddSub1>::NThrice>
+ Add<<Self as AddSub1>::NTwice, Output=Self>
+ Sub<<Self as AddSub1>::NTwice>
+ Add<<Self as AddSub1>::Neg, Output=<Self as AddSub1>::Twice>
+ Sub<<Self as AddSub1>::Neg>
+ Add<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::Thrice>
+ Sub<<Self as AddSub1>::Zero, Output=<Self as AddSub1>::Thrice>
+ Add<Self>
+ Sub<Self, Output=<Self as AddSub1>::Twice>
+ Add<<Self as AddSub1>::Twice>
+ Sub<<Self as AddSub1>::Twice, Output=Self>
+ Add<<Self as AddSub1>::Thrice>
+ Sub<<Self as AddSub1>::Thrice, Output=<Self as AddSub1>::Zero>
;
}
impl<NThriceP, NTwiceP, NegP, ZeroP, A, TwiceP, ThriceP> AddSub1 for A
where
NThriceP
: Add<NThriceP>
+ Sub<NThriceP, Output=ZeroP>
+ Add<NTwiceP>
+ Sub<NTwiceP, Output=NegP>
+ Add<NegP>
+ Sub<NegP, Output=NTwiceP>
+ Add<ZeroP, Output=NThriceP>
+ Sub<ZeroP, Output=NThriceP>
+ Add<A, Output=NTwiceP>
+ Sub<A>
+ Add<TwiceP, Output=NegP>
+ Sub<TwiceP>
+ Add<ThriceP, Output=ZeroP>
+ Sub<ThriceP>
,
NTwiceP
: Add<NThriceP>
+ Sub<NThriceP, Output=A>
+ Add<NTwiceP>
+ Sub<NTwiceP, Output=ZeroP>
+ Add<NegP, Output=NThriceP>
+ Sub<NegP, Output=NegP>
+ Add<ZeroP, Output=NTwiceP>
+ Sub<ZeroP, Output=NTwiceP>
+ Add<A, Output=NegP>
+ Sub<A, Output=NThriceP>
+ Add<TwiceP, Output=ZeroP>
+ Sub<TwiceP>
+ Add<ThriceP, Output=A>
+ Sub<ThriceP>
,
NegP
: Add<NThriceP>
+ Sub<NThriceP, Output=TwiceP>
+ Add<NTwiceP, Output=NThriceP>
+ Sub<NTwiceP, Output=A>
+ Add<NegP, Output=NTwiceP>
+ Sub<NegP, Output=ZeroP>
+ Add<ZeroP, Output=NegP>
+ Sub<ZeroP, Output=NegP>
+ Add<A, Output=ZeroP>
+ Sub<A, Output=NTwiceP>
+ Add<TwiceP, Output=A>
+ Sub<TwiceP, Output=NThriceP>
+ Add<ThriceP, Output=TwiceP>
+ Sub<ThriceP>
,
ZeroP
: Add<NThriceP, Output=NThriceP>
+ Sub<NThriceP, Output=ThriceP>
+ Add<NTwiceP, Output=NTwiceP>
+ Sub<NTwiceP, Output=TwiceP>
+ Add<NegP, Output=NegP>
+ Sub<NegP, Output=A>
+ Add<ZeroP, Output=ZeroP>
+ Sub<ZeroP, Output=ZeroP>
+ Add<A, Output=A>
+ Sub<A, Output=NegP>
+ Add<TwiceP, Output=TwiceP>
+ Sub<TwiceP, Output=NTwiceP>
+ Add<ThriceP, Output=ThriceP>
+ Sub<ThriceP, Output=NThriceP>
,
A
: Sized
+ Add<NThriceP, Output=NTwiceP>
+ Sub<NThriceP>
+ Add<NTwiceP, Output=NegP>
+ Sub<NTwiceP, Output=ThriceP>
+ Add<NegP, Output=ZeroP>
+ Sub<NegP, Output=TwiceP>
+ Add<ZeroP, Output=A>
+ Sub<ZeroP, Output=A>
+ Add<A, Output=TwiceP>
+ Sub<A, Output=ZeroP>
+ Add<TwiceP, Output=ThriceP>
+ Sub<TwiceP, Output=NegP>
+ Add<ThriceP>
+ Sub<ThriceP, Output=NTwiceP>
,
TwiceP
: Add<NThriceP, Output=NegP>
+ Sub<NThriceP>
+ Add<NTwiceP, Output=ZeroP>
+ Sub<NTwiceP>
+ Add<NegP, Output=A>
+ Sub<NegP, Output=ThriceP>
+ Add<ZeroP, Output=TwiceP>
+ Sub<ZeroP, Output=TwiceP>
+ Add<A, Output=ThriceP>
+ Sub<A, Output=A>
+ Add<TwiceP>
+ Sub<TwiceP, Output=ZeroP>
+ Add<ThriceP>
+ Sub<ThriceP, Output=NegP>
,
ThriceP
: Add<NThriceP, Output=ZeroP>
+ Sub<NThriceP>
+ Add<NTwiceP, Output=A>
+ Sub<NTwiceP>
+ Add<NegP, Output=TwiceP>
+ Sub<NegP>
+ Add<ZeroP, Output=ThriceP>
+ Sub<ZeroP, Output=ThriceP>
+ Add<A>
+ Sub<A, Output=TwiceP>
+ Add<TwiceP>
+ Sub<TwiceP, Output=A>
+ Add<ThriceP>
+ Sub<ThriceP, Output=ZeroP>
,
{
type NThrice = NThriceP;
type NTwice = NTwiceP;
type Neg = NegP;
type Zero = ZeroP;
type Twice = TwiceP;
type Thrice = ThriceP;
}
pub trait AddSub2<OtherP>
: Sized
+ Add<<Self as AddSub2<OtherP>>::Zero, Output=Self>
+ Sub<<Self as AddSub2<OtherP>>::Zero, Output=Self>
+ Add<<Self as AddSub2<OtherP>>::Other, Output=<Self as AddSub2<OtherP>>::Add>
+ Sub<<Self as AddSub2<OtherP>>::Other, Output=<Self as AddSub2<OtherP>>::Sub>
+ Add<<Self as AddSub2<OtherP>>::NOther, Output=<Self as AddSub2<OtherP>>::Sub>
+ Sub<<Self as AddSub2<OtherP>>::NOther, Output=<Self as AddSub2<OtherP>>::Add>
+ Add<Self>
+ Sub<Self, Output=<Self as AddSub2<OtherP>>::Zero>
+ Add<<Self as AddSub2<OtherP>>::Add>
+ Sub<<Self as AddSub2<OtherP>>::Add, Output=<Self as AddSub2<OtherP>>::NOther>
+ Add<<Self as AddSub2<OtherP>>::Sub>
+ Sub<<Self as AddSub2<OtherP>>::Sub, Output=<Self as AddSub2<OtherP>>::Other>
+ Add<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::Zero>
+ Sub<<Self as AddSub2<OtherP>>::Neg>
+ Add<<Self as AddSub2<OtherP>>::NSub, Output=<Self as AddSub2<OtherP>>::Other>
+ Sub<<Self as AddSub2<OtherP>>::NSub>
+ Add<<Self as AddSub2<OtherP>>::NAdd, Output=<Self as AddSub2<OtherP>>::NOther>
+ Sub<<Self as AddSub2<OtherP>>::NAdd>
{
type Zero
: Add<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::Zero>
+ Sub<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::Zero>
+ Add<<Self as AddSub2<OtherP>>::Other, Output=<Self as AddSub2<OtherP>>::Other>
+ Sub<<Self as AddSub2<OtherP>>::Other, Output=<Self as AddSub2<OtherP>>::NOther>
+ Add<<Self as AddSub2<OtherP>>::NOther, Output=<Self as AddSub2<OtherP>>::NOther>
+ Sub<<Self as AddSub2<OtherP>>::NOther, Output=<Self as AddSub2<OtherP>>::Other>
+ Add<Self, Output=Self>
+ Sub<Self, Output=<Self as AddSub2<OtherP>>::Neg>
+ Add<<Self as AddSub2<OtherP>>::Add, Output=<Self as AddSub2<OtherP>>::Add>
+ Sub<<Self as AddSub2<OtherP>>::Add, Output=<Self as AddSub2<OtherP>>::NAdd>
+ Add<<Self as AddSub2<OtherP>>::Sub, Output=<Self as AddSub2<OtherP>>::Sub>
+ Sub<<Self as AddSub2<OtherP>>::Sub, Output=<Self as AddSub2<OtherP>>::NSub>
+ Add<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::Neg>
+ Sub<<Self as AddSub2<OtherP>>::Neg, Output=Self>
+ Add<<Self as AddSub2<OtherP>>::NSub, Output=<Self as AddSub2<OtherP>>::NSub>
+ Sub<<Self as AddSub2<OtherP>>::NSub, Output=<Self as AddSub2<OtherP>>::Sub>
+ Add<OtherP, Output=<Self as AddSub2<OtherP>>::Other>
+ Sub<OtherP, Output=<Self as AddSub2<OtherP>>::NOther>
+ Add<<Self as AddSub2<OtherP>>::NAdd, Output=<Self as AddSub2<OtherP>>::NAdd>
+ Sub<<Self as AddSub2<OtherP>>::NAdd, Output=<Self as AddSub2<OtherP>>::Add>
;
type Other
: Add<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::Other>
+ Sub<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::Other>
+ Add<<Self as AddSub2<OtherP>>::Other>
+ Sub<<Self as AddSub2<OtherP>>::Other, Output=<Self as AddSub2<OtherP>>::Zero>
+ Add<<Self as AddSub2<OtherP>>::NOther, Output=<Self as AddSub2<OtherP>>::Zero>
+ Sub<<Self as AddSub2<OtherP>>::NOther>
+ Add<Self, Output=<Self as AddSub2<OtherP>>::Add>
+ Sub<Self, Output=<Self as AddSub2<OtherP>>::NSub>
+ Add<<Self as AddSub2<OtherP>>::Add>
+ Sub<<Self as AddSub2<OtherP>>::Add, Output=<Self as AddSub2<OtherP>>::Neg>
+ Add<<Self as AddSub2<OtherP>>::Sub, Output=Self>
+ Sub<<Self as AddSub2<OtherP>>::Sub>
+ Add<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::NSub>
+ Sub<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::Add>
+ Add<<Self as AddSub2<OtherP>>::NSub>
+ Sub<<Self as AddSub2<OtherP>>::NSub, Output=Self>
+ Add<<Self as AddSub2<OtherP>>::NAdd, Output=<Self as AddSub2<OtherP>>::Neg>
+ Sub<<Self as AddSub2<OtherP>>::NAdd>
;
type NOther
: Add<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::NOther>
+ Sub<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::NOther>
+ Add<<Self as AddSub2<OtherP>>::Other, Output=<Self as AddSub2<OtherP>>::Zero>
+ Sub<<Self as AddSub2<OtherP>>::Other>
+ Add<<Self as AddSub2<OtherP>>::NOther>
+ Sub<<Self as AddSub2<OtherP>>::NOther, Output=<Self as AddSub2<OtherP>>::Zero>
+ Add<Self, Output=<Self as AddSub2<OtherP>>::Sub>
+ Sub<Self, Output=<Self as AddSub2<OtherP>>::NAdd>
+ Add<<Self as AddSub2<OtherP>>::Add, Output=Self>
+ Sub<<Self as AddSub2<OtherP>>::Add>
+ Add<<Self as AddSub2<OtherP>>::Sub>
+ Sub<<Self as AddSub2<OtherP>>::Sub, Output=<Self as AddSub2<OtherP>>::Neg>
+ Add<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::NAdd>
+ Sub<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::Sub>
+ Add<<Self as AddSub2<OtherP>>::NSub, Output=<Self as AddSub2<OtherP>>::Neg>
+ Sub<<Self as AddSub2<OtherP>>::NSub>
+ Add<<Self as AddSub2<OtherP>>::NAdd>
+ Sub<<Self as AddSub2<OtherP>>::NAdd, Output=Self>
;
type Add
: Add<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::Add>
+ Sub<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::Add>
+ Add<<Self as AddSub2<OtherP>>::Other>
+ Sub<<Self as AddSub2<OtherP>>::Other, Output=Self>
+ Add<<Self as AddSub2<OtherP>>::NOther, Output=Self>
+ Sub<<Self as AddSub2<OtherP>>::NOther>
+ Add<Self>
+ Sub<Self, Output=<Self as AddSub2<OtherP>>::Other>
+ Add<<Self as AddSub2<OtherP>>::Add>
+ Sub<<Self as AddSub2<OtherP>>::Add, Output=<Self as AddSub2<OtherP>>::Zero>
+ Add<<Self as AddSub2<OtherP>>::Sub>
+ Sub<<Self as AddSub2<OtherP>>::Sub>
+ Add<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::Other>
+ Sub<<Self as AddSub2<OtherP>>::Neg>
+ Add<<Self as AddSub2<OtherP>>::NSub>
+ Sub<<Self as AddSub2<OtherP>>::NSub>
+ Add<<Self as AddSub2<OtherP>>::NAdd, Output=<Self as AddSub2<OtherP>>::Zero>
+ Sub<<Self as AddSub2<OtherP>>::NAdd>
;
type Sub
: Add<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::Sub>
+ Sub<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::Sub>
+ Add<<Self as AddSub2<OtherP>>::Other, Output=Self>
+ Sub<<Self as AddSub2<OtherP>>::Other>
+ Add<<Self as AddSub2<OtherP>>::NOther>
+ Sub<<Self as AddSub2<OtherP>>::NOther, Output=Self>
+ Add<Self>
+ Sub<Self, Output=<Self as AddSub2<OtherP>>::NOther>
+ Add<<Self as AddSub2<OtherP>>::Add>
+ Sub<<Self as AddSub2<OtherP>>::Add>
+ Add<<Self as AddSub2<OtherP>>::Sub>
+ Sub<<Self as AddSub2<OtherP>>::Sub, Output=<Self as AddSub2<OtherP>>::Zero>
+ Add<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::NOther>
+ Sub<<Self as AddSub2<OtherP>>::Neg>
+ Add<<Self as AddSub2<OtherP>>::NSub, Output=<Self as AddSub2<OtherP>>::Zero>
+ Sub<<Self as AddSub2<OtherP>>::NSub>
+ Add<<Self as AddSub2<OtherP>>::NAdd>
+ Sub<<Self as AddSub2<OtherP>>::NAdd>
;
type Neg
: Add<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::Neg>
+ Sub<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::Neg>
+ Add<<Self as AddSub2<OtherP>>::Other, Output=<Self as AddSub2<OtherP>>::NSub>
+ Sub<<Self as AddSub2<OtherP>>::Other, Output=<Self as AddSub2<OtherP>>::NAdd>
+ Add<<Self as AddSub2<OtherP>>::NOther, Output=<Self as AddSub2<OtherP>>::NAdd>
+ Sub<<Self as AddSub2<OtherP>>::NOther, Output=<Self as AddSub2<OtherP>>::NSub>
+ Add<Self, Output=<Self as AddSub2<OtherP>>::Zero>
+ Sub<Self>
+ Add<<Self as AddSub2<OtherP>>::Add, Output=<Self as AddSub2<OtherP>>::Other>
+ Sub<<Self as AddSub2<OtherP>>::Add>
+ Add<<Self as AddSub2<OtherP>>::Sub, Output=<Self as AddSub2<OtherP>>::NOther>
+ Sub<<Self as AddSub2<OtherP>>::Sub>
+ Add<<Self as AddSub2<OtherP>>::Neg>
+ Sub<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::Zero>
+ Add<<Self as AddSub2<OtherP>>::NSub>
+ Sub<<Self as AddSub2<OtherP>>::NSub, Output=<Self as AddSub2<OtherP>>::NOther>
+ Add<<Self as AddSub2<OtherP>>::NAdd>
+ Sub<<Self as AddSub2<OtherP>>::NAdd, Output=<Self as AddSub2<OtherP>>::Other>
;
type NSub
: Add<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::NSub>
+ Sub<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::NSub>
+ Add<<Self as AddSub2<OtherP>>::Other>
+ Sub<<Self as AddSub2<OtherP>>::Other, Output=<Self as AddSub2<OtherP>>::Neg>
+ Add<<Self as AddSub2<OtherP>>::NOther, Output=<Self as AddSub2<OtherP>>::Neg>
+ Sub<<Self as AddSub2<OtherP>>::NOther>
+ Add<Self, Output=<Self as AddSub2<OtherP>>::Other>
+ Sub<Self>
+ Add<<Self as AddSub2<OtherP>>::Add>
+ Sub<<Self as AddSub2<OtherP>>::Add>
+ Add<<Self as AddSub2<OtherP>>::Sub, Output=<Self as AddSub2<OtherP>>::Zero>
+ Sub<<Self as AddSub2<OtherP>>::Sub>
+ Add<<Self as AddSub2<OtherP>>::Neg>
+ Sub<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::Other>
+ Add<<Self as AddSub2<OtherP>>::NSub>
+ Sub<<Self as AddSub2<OtherP>>::NSub, Output=<Self as AddSub2<OtherP>>::Zero>
+ Add<<Self as AddSub2<OtherP>>::NAdd>
+ Sub<<Self as AddSub2<OtherP>>::NAdd>
;
type NAdd
: Add<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::NAdd>
+ Sub<<Self as AddSub2<OtherP>>::Zero, Output=<Self as AddSub2<OtherP>>::NAdd>
+ Add<<Self as AddSub2<OtherP>>::Other, Output=<Self as AddSub2<OtherP>>::Neg>
+ Sub<<Self as AddSub2<OtherP>>::Other>
+ Add<<Self as AddSub2<OtherP>>::NOther>
+ Sub<<Self as AddSub2<OtherP>>::NOther, Output=<Self as AddSub2<OtherP>>::Neg>
+ Add<Self, Output=<Self as AddSub2<OtherP>>::NOther>
+ Sub<Self>
+ Add<<Self as AddSub2<OtherP>>::Add, Output=<Self as AddSub2<OtherP>>::Zero>
+ Sub<<Self as AddSub2<OtherP>>::Add>
+ Add<<Self as AddSub2<OtherP>>::Sub>
+ Sub<<Self as AddSub2<OtherP>>::Sub>
+ Add<<Self as AddSub2<OtherP>>::Neg>
+ Sub<<Self as AddSub2<OtherP>>::Neg, Output=<Self as AddSub2<OtherP>>::NOther>
+ Add<<Self as AddSub2<OtherP>>::NSub>
+ Sub<<Self as AddSub2<OtherP>>::NSub>
+ Add<<Self as AddSub2<OtherP>>::NAdd>
+ Sub<<Self as AddSub2<OtherP>>::NAdd, Output=<Self as AddSub2<OtherP>>::Zero>
;
}
impl<ZeroP, OtherP, NOtherP, A, AddP, SubP, NegP, NSubP, NAddP> AddSub2<OtherP> for A
where
ZeroP
: Add<ZeroP, Output=ZeroP>
+ Sub<ZeroP, Output=ZeroP>
+ Add<OtherP, Output=OtherP>
+ Sub<OtherP, Output=NOtherP>
+ Add<NOtherP, Output=NOtherP>
+ Sub<NOtherP, Output=OtherP>
+ Add<A, Output=A>
+ Sub<A, Output=NegP>
+ Add<AddP, Output=AddP>
+ Sub<AddP, Output=NAddP>
+ Add<SubP, Output=SubP>
+ Sub<SubP, Output=NSubP>
+ Add<NegP, Output=NegP>
+ Sub<NegP, Output=A>
+ Add<NSubP, Output=NSubP>
+ Sub<NSubP, Output=SubP>
+ Add<NAddP, Output=NAddP>
+ Sub<NAddP, Output=AddP>
,
OtherP
: Add<ZeroP, Output=OtherP>
+ Sub<ZeroP, Output=OtherP>
+ Add<OtherP>
+ Sub<OtherP, Output=ZeroP>
+ Add<NOtherP, Output=ZeroP>
+ Sub<NOtherP>
+ Add<A, Output=AddP>
+ Sub<A, Output=NSubP>
+ Add<AddP>
+ Sub<AddP, Output=NegP>
+ Add<SubP, Output=A>
+ Sub<SubP>
+ Add<NegP, Output=NSubP>
+ Sub<NegP, Output=AddP>
+ Add<NSubP>
+ Sub<NSubP, Output=A>
+ Add<NAddP, Output=NegP>
+ Sub<NAddP>
,
NOtherP
: Add<ZeroP, Output=NOtherP>
+ Sub<ZeroP, Output=NOtherP>
+ Add<OtherP, Output=ZeroP>
+ Sub<OtherP>
+ Add<NOtherP>
+ Sub<NOtherP, Output=ZeroP>
+ Add<A, Output=SubP>
+ Sub<A, Output=NAddP>
+ Add<AddP, Output=A>
+ Sub<AddP>
+ Add<SubP>
+ Sub<SubP, Output=NegP>
+ Add<NegP, Output=NAddP>
+ Sub<NegP, Output=SubP>
+ Add<NSubP, Output=NegP>
+ Sub<NSubP>
+ Add<NAddP>
+ Sub<NAddP, Output=A>
,
A
: Sized
+ Add<ZeroP, Output=A>
+ Sub<ZeroP, Output=A>
+ Add<OtherP, Output=AddP>
+ Sub<OtherP, Output=SubP>
+ Add<NOtherP, Output=SubP>
+ Sub<NOtherP, Output=AddP>
+ Add<A>
+ Sub<A, Output=ZeroP>
+ Add<AddP>
+ Sub<AddP, Output=NOtherP>
+ Add<SubP>
+ Sub<SubP, Output=OtherP>
+ Add<NegP, Output=ZeroP>
+ Sub<NegP>
+ Add<NSubP, Output=OtherP>
+ Sub<NSubP>
+ Add<NAddP, Output=NOtherP>
+ Sub<NAddP>
,
AddP
: Add<ZeroP, Output=AddP>
+ Sub<ZeroP, Output=AddP>
+ Add<OtherP>
+ Sub<OtherP, Output=A>
+ Add<NOtherP, Output=A>
+ Sub<NOtherP>
+ Add<A>
+ Sub<A, Output=OtherP>
+ Add<AddP>
+ Sub<AddP, Output=ZeroP>
+ Add<SubP>
+ Sub<SubP>
+ Add<NegP, Output=OtherP>
+ Sub<NegP>
+ Add<NSubP>
+ Sub<NSubP>
+ Add<NAddP, Output=ZeroP>
+ Sub<NAddP>
,
SubP
: Add<ZeroP, Output=SubP>
+ Sub<ZeroP, Output=SubP>
+ Add<OtherP, Output=A>
+ Sub<OtherP>
+ Add<NOtherP>
+ Sub<NOtherP, Output=A>
+ Add<A>
+ Sub<A, Output=NOtherP>
+ Add<AddP>
+ Sub<AddP>
+ Add<SubP>
+ Sub<SubP, Output=ZeroP>
+ Add<NegP, Output=NOtherP>
+ Sub<NegP>
+ Add<NSubP, Output=ZeroP>
+ Sub<NSubP>
+ Add<NAddP>
+ Sub<NAddP>
,
NegP
: Add<ZeroP, Output=NegP>
+ Sub<ZeroP, Output=NegP>
+ Add<OtherP, Output=NSubP>
+ Sub<OtherP, Output=NAddP>
+ Add<NOtherP, Output=NAddP>
+ Sub<NOtherP, Output=NSubP>
+ Add<A, Output=ZeroP>
+ Sub<A>
+ Add<AddP, Output=OtherP>
+ Sub<AddP>
+ Add<SubP, Output=NOtherP>
+ Sub<SubP>
+ Add<NegP>
+ Sub<NegP, Output=ZeroP>
+ Add<NSubP>
+ Sub<NSubP, Output=NOtherP>
+ Add<NAddP>
+ Sub<NAddP, Output=OtherP>
,
NSubP
: Add<ZeroP, Output=NSubP>
+ Sub<ZeroP, Output=NSubP>
+ Add<OtherP>
+ Sub<OtherP, Output=NegP>
+ Add<NOtherP, Output=NegP>
+ Sub<NOtherP>
+ Add<A, Output=OtherP>
+ Sub<A>
+ Add<AddP>
+ Sub<AddP>
+ Add<SubP, Output=ZeroP>
+ Sub<SubP>
+ Add<NegP>
+ Sub<NegP, Output=OtherP>
+ Add<NSubP>
+ Sub<NSubP, Output=ZeroP>
+ Add<NAddP>
+ Sub<NAddP>
,
NAddP
: Add<ZeroP, Output=NAddP>
+ Sub<ZeroP, Output=NAddP>
+ Add<OtherP, Output=NegP>
+ Sub<OtherP>
+ Add<NOtherP>
+ Sub<NOtherP, Output=NegP>
+ Add<A, Output=NOtherP>
+ Sub<A>
+ Add<AddP, Output=ZeroP>
+ Sub<AddP>
+ Add<SubP>
+ Sub<SubP>
+ Add<NegP>
+ Sub<NegP, Output=NOtherP>
+ Add<NSubP>
+ Sub<NSubP>
+ Add<NAddP>
+ Sub<NAddP, Output=ZeroP>
,
{
type Zero = ZeroP;
type Other = OtherP;
type NOther = NOtherP;
type Add = AddP;
type Sub = SubP;
type Neg = NegP;
type NSub = NSubP;
type NAdd = NAddP;
}
fn foo<A: AddSub2<B>, B>(a: A, b: B) {
// This only works if
// + Add<OtherP, Output=<Self as AddSub2<OtherP>>::Other>
// is the very last "Add" bound in the list of bounds on AddSub2::Zero.
a - a + b;
}
fn bar() {
foo(::dim::typenum::P3::new(), ::dim::typenum::P7::new());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment