From fe74d58958aad8145385472601641723066ac254 Mon Sep 17 00:00:00 2001 From: xposure Date: Sun, 3 Jan 2021 19:55:28 -0500 Subject: [PATCH 1/2] DeleteDictionaryAndItems --- BeefLibs/corlib/src/System.bf | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/BeefLibs/corlib/src/System.bf b/BeefLibs/corlib/src/System.bf index d7c6f7ef..53a2731b 100644 --- a/BeefLibs/corlib/src/System.bf +++ b/BeefLibs/corlib/src/System.bf @@ -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) From aeb0e70d218045a3fd0e4614b2dc7fae49ea089a Mon Sep 17 00:00:00 2001 From: xposure Date: Sun, 3 Jan 2021 21:07:34 -0500 Subject: [PATCH 2/2] Adds implicit Span operator to String --- BeefLibs/corlib/src/String.bf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/BeefLibs/corlib/src/String.bf b/BeefLibs/corlib/src/String.bf index 5daa6750..6a5346b1 100644 --- a/BeefLibs/corlib/src/String.bf +++ b/BeefLibs/corlib/src/String.bf @@ -551,6 +551,13 @@ namespace System return str.Ptr; } + public static implicit operator Span(String str) + { + if (str == null) + return .(null, 0); + return .(str.Ptr, str.Length); + } + [Commutable] public static bool operator==(String s1, String s2) {