hashed array?
H. S. Teoh
hsteoh at quickfur.ath.cx
Mon Nov 12 08:21:13 PST 2012
On Mon, Nov 12, 2012 at 03:43:57PM +0100, monarch_dodra wrote:
> D has a built in hashed associative container, which is great.
>
> I've noticed though it has no built-in "hashed container" for when
> you just need to store unique elements, but without any specific
> data associated (lists of names, for example).
>
> Has anybody requested this before? Would there be any plans for it?
Well, I haven't *requested* this before, but I've certainly encountered
the need for it.
It's not too hard to implement, actually, you can basically just use the
same code as the current AA implementation, minus the parts that deal
with values. Then modify the lookup functions to return false when no
key is found (instead of a[b] throwing an exception when b isn't in a,
or returning a null value with the 'in' operator), and you're good to
go.
T
--
"You are a very disagreeable person." "NO."
More information about the Digitalmars-d
mailing list