On 08.01.2012 11:27, Jonathan M Davis wrote:
On Sunday, January 08, 2012 11:02:41 simendsjo wrote:
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
}

Since the element has been removed from the container, what would the pointer
point to? The element doesn't exist anymore.

- Jonathan m Davis

I was thinking it could be a shorthand for the following:

auto item = key in aa;
if (item) key.remove(key);

Reply via email to