On Sun, 29 May 2011 16:41:56 -0400, David Nadlinger <[email protected]>
wrote:
On 5/29/11 10:21 PM, Nick Sabalausky wrote:
"David Nadlinger"<[email protected]> wrote in message
news:[email protected]...
[…]
is there a reason bool isn't allowed as key type for associative arrays
(mtype.c:3995)? The docs don't mention this. […]
It works for me. I use it all the time as a hash set. What version are
you
on? I've been using D2, maybe it's a D1 issue? If so, I'd file a bug
report.
Are you sure you are using bool _keys_, not values? On a related note,
https://github.com/D-Programming-Language/dmd/pull/77 seems to be all
required for making them work.
By the way, do you happen to have a complete hash set implementation
lying around? I'd be interested in preparing and proposing one for
std.container, as I need one for Thrift (currently, I have a really,
REALLY preliminary and buggy one based on a void[0] AA, see
https://github.com/klickverbot/thrift/blob/d-gsoc/lib/d/src/thrift/hashset.d).
There is always dcollections (has both Hash- and TreeSet). It is boost
1.0, so feel free to steal anything to propose for std.container (in fact,
RedBlackTree is from dcollections). Note that I'm nowhere near an expert
on hashing, so I'm not sure how it will perform against AAs. I know it
does beat them using my custom allocator, but that's not a truly fair
comparison -- AA's could be written with a custom allocator too.
-Steve