RedBlackTree - Phobos suite implementation. The problem you are facing with removeKey is that it is a variable. This will take either an array of keys to delete, or several keys (for example, removeKey(arr) or removeKey(key1, key2, key3) ). string is an array of immmutable chars, so it tries to create an removeKey instance with char instead of string , which does not work because your tree contains strings, not characters. You would not have such a problem if you were dealing with RedBlackTree for int or any other type without an array.
What you need to do is either give it an array of strings, or create it directly, i.e. removeKey([s]) or removeKey!string(s) .
By the way, std.container went the way of naming its container types based on their data structure, and not what they are used for. So, when you say that you do not need a red-black tree, this is not entirely correct. You want a set. You just don't care how it is implemented. Two typical ways to implement sets include using a red-black tree or a hash table. So, RedBlackTree gives you one way to have a kit. It's just that it was named after the data structure, and not how you could use it, so if you are looking for the name of the Set container in std.container, you will not find it.
EDIT : An error report exists for this, and a fix has been submitted. Thus, in a future version of dmd, it should be possible to pass string to removeKey without the need to directly instantiate or pass string inside the array.
source share