浏览代码

Add Clear method for THashSet

maciej-izak 7 年之前
父节点
当前提交
660888527c
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      Units/Utils/generics.collections.pas

+ 6 - 0
Units/Utils/generics.collections.pas

@@ -427,6 +427,7 @@ type
     destructor Destroy; override;
     function Add(constref AValue: T): Boolean;
     function Remove(constref AValue: T): Boolean;
+    procedure Clear;
     function Contains(constref AValue: T): Boolean; inline;
     procedure UnionWith(AHashSet: THashSet<T>);
     procedure IntersectWith(AHashSet: THashSet<T>);
@@ -1617,6 +1618,11 @@ begin
     FInternalDictionary.DoRemove(LIndex, cnRemoved);
 end;
 
+procedure THashSet<T>.Clear;
+begin
+  FInternalDictionary.Clear;
+end;
+
 function THashSet<T>.Contains(constref AValue: T): Boolean;
 begin
   Result := FInternalDictionary.ContainsKey(AValue);