1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Merge pull request #785 from xposure/master

DeleteDictionaryAndItems + String to span<char8>
This commit is contained in:
Brian Fiete 2021-01-04 04:47:31 -08:00 committed by GitHub
commit d78cb3182a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View file

@ -551,6 +551,13 @@ namespace System
return str.Ptr;
}
public static implicit operator Span<char8>(String str)
{
if (str == null)
return .(null, 0);
return .(str.Ptr, str.Length);
}
[Commutable]
public static bool operator==(String s1, String s2)
{

View file

@ -187,6 +187,18 @@ static
}
}
public static mixin DeleteDictionaryAndItems(var container)
{
if (container != null)
{
for (var value in container)
{
delete value.value;
}
delete container;
}
}
public static mixin DeleteDictionaryAndKeysAndItems(var container)
{
if (container != null)