associative arrays

simendsjo simendsjo at gmail.com
Sun Jan 8 02:02:41 PST 2012


On 08.01.2012 10:43, Jonathan M Davis wrote:
> On Sunday, January 08, 2012 03:24:22 Kapps wrote:
>> Ah, found the bug / pull request.
>>
>> https://github.com/D-Programming-Language/dmd/pull/597
>> http://d.puremagic.com/issues/show_bug.cgi?id=4523
>
> Ah, TDPL says that it returns bool. Well, then it definitely needs to be
> changed, and it's good to see that that there's a pull request for it. So, it
> should be fixed in the next release. In fact, the number of TDPL-related bugs
> fixed for the next release should be quite high, which is great.
>
> - Jonathan M Davis

Wouldn't it make sense to return a pointer to the item being 
removed/null? This way you can continue to work with the item, and it 
would be consistent with `in`.

if (auto item = aa.remove(key)) {
   // some additional work on item
} else { // not found
   // throw or something
}


More information about the Digitalmars-d-learn mailing list