Why isn't bool allowed as AA key type?

David Nadlinger see at klickverbot.at
Sun May 29 13:41:56 PDT 2011


On 5/29/11 10:21 PM, Nick Sabalausky wrote:
> "David Nadlinger"<see at klickverbot.at>  wrote in message
> news:irrd5h$hdj$1 at digitalmars.com...
>> […]
>> 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).

David


More information about the Digitalmars-d mailing list