Why isn't bool allowed as AA key type?

Daniel Gibson metalcaedes at gmail.com
Sun May 29 13:27:27 PDT 2011


Am 29.05.2011 22:21, schrieb Nick Sabalausky:
> "David Nadlinger" <see at klickverbot.at> wrote in message 
> news:irrd5h$hdj$1 at digitalmars.com...
>> Hello all,
>>
>> is there a reason bool isn't allowed as key type for associative arrays 
>> (mtype.c:3995)? The docs don't mention this.
>>
>> bool-key AAs probably wouldn't be too useful in practice, but it seems 
>> like a quite arbitrary and unexpected limitation to me - e.g. I would have 
>> to add special cases to all my Thrift map handling code.
>>
>> In case this is not on purpose, I'd be happy to put together a pull 
>> request.
>>
> 
> 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.
> 
> 
void main() {
	string[bool] map;
}

test.d(2): Error: can't have associative array key of bool


More information about the Digitalmars-d mailing list