hashed array?
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Mon Nov 12 08:52:32 PST 2012
On 11/12/2012 05:27 PM, Dmitry Olshansky wrote:
>> The current "workaround" is to just dummy it.
>> alias bool Dummy;
>> Dummy[string] names;
>> names["Paul"] = true; //Ew.
>
> Make a wrapper?
The problem with wrapped versions of associative arrays is that they just don't
scale with number of keys. If I want to store (say) a set of 3 million
size_t's, then it costs a lot more than 3_000_000 * size_t.sizeof() to do so
this way.
Do dedicated set implementations do better than this?
I should say that my own interests in an implementation of set are twofold --
first, efficient storage; and second, being able to do an efficient foreach
across the stored values, without any concern for order.
> Or rather call them sets and have them in the library.
The whole builtin-vs.-library thing seems a big distraction -- if something
needs to be implemented, the library seems the natural place unless there's a
very good reason otherwise.
More information about the Digitalmars-d
mailing list