1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-21 01:18:02 +02:00

Sized array .InitAll elemented initializer

This commit is contained in:
Brian Fiete 2022-08-23 12:07:02 -07:00
parent 05e002d8f5
commit 77a99bdacc
3 changed files with 45 additions and 7 deletions

View file

@ -15,6 +15,8 @@ namespace System
}
}
public explicit static operator T[CSize] (Self val)
{
return val.mVal;
@ -109,6 +111,28 @@ namespace System
return Current;
}
}
public static T[CSize] InitAll
{
[Error("Element type has no default constructor")]
get
{
return default;
}
}
}
extension SizedArray<T, CSize> where T : struct, new
{
public static T[CSize] InitAll
{
get
{
T[CSize] val;
for (int i < CSize)
val[i] = T();
return val;
}
}
}
}