-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Proposal: Add hash sets to the standard library #6919
Copy link
Copy link
Open
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Metadata
Metadata
Assignees
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Hash sets can be currently be done using
AutoHashMap(K, void)but I'd argue that an actual hash set type would make working with them much nicer. Using a hash map, you have to explicitly access thekeymember of anEntryto get the value (and I sometimes accidentally tryvaluefirst instead since when used as a set, the keys are the values), pass{}as the value every time you add something, and you have member functions that are meaningless when using it as a set. With a HashSet type you wouldn't have that cruft, and specific operations for working with sets could even be added if desired.