26191abc7252 — Leonard Ritter a month ago
* `Map`: added copy operator
1 files changed, 6 insertions(+), 0 deletions(-)

M lib/scopes/Map.sc
M lib/scopes/Map.sc +6 -0
@@ 363,6 363,12 @@ typedef Map < Struct
         free self._keys
         free self._values
 
+    fn __copy (self)
+        local other : (typeof self)
+        for k v in self
+            'set other (copy k) (copy v)
+        other
+
     inline __typecall (cls opts...)
         static-if (cls == this-type)
             let key-type value-type function-type = opts...