mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Improved constraint checks where generic param type constraint passes
This commit is contained in:
parent
116d9c6f01
commit
b7725d0ed0
4 changed files with 76 additions and 1 deletions
|
@ -7,6 +7,19 @@ namespace Tests
|
|||
{
|
||||
class Constraints
|
||||
{
|
||||
struct Vector2<T>
|
||||
{
|
||||
public T mX;
|
||||
public T mY;
|
||||
}
|
||||
|
||||
extension Vector2<T> where T : float
|
||||
{
|
||||
public T LengthSquared => mX * mX + mY * mY;
|
||||
public T Length => Math.Sqrt(LengthSquared);
|
||||
public T NegX = -mX;
|
||||
}
|
||||
|
||||
class Dicto : Dictionary<int, float>
|
||||
{
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue