D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6472 - RedBlackTree.removeKey
Summary: RedBlackTree.removeKey
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-11 19:01 UTC by Ellery Newcomer
Modified: 2012-02-10 06:53 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ellery Newcomer 2011-08-11 19:01:44 UTC
dmd32 2.054

the code:

import std.container;
void main(){
    auto t = make!(RedBlackTree!(string));
    t.insert(["1","2","3"]);
    t.removeKey("1");
}


the fireworks:

error9.d(10): Error: template std.container.RedBlackTree!(string).RedBlackTree.removeKey(U) if (isImplicitlyConvertible!(U,Elem)) does not match any function template declaration
error9.d(10): Error: template std.container.RedBlackTree!(string).RedBlackTree.removeKey(U) if (isImplicitlyConvertible!(U,Elem)) cannot deduce template function from argument types !()(string)
Comment 1 Jonathan M Davis 2011-08-11 21:05:21 UTC
t.removeKey!string("1");

I believe that this is a case of template inferrence failing, because it's deciding that the input to removeKey is a range a dchars rather than a single string, and you can't covert dchar to the element type of the container (string), and so compilation fails. I don't know how fixable it is with template constraints. Hopefully someone can sort it out, but it may be that the compiler is just too stupid in this case.
Comment 2 Jonathan M Davis 2011-12-10 23:26:09 UTC
https://github.com/D-Programming-Language/phobos/pull/363
Comment 3 github-bugzilla 2012-02-05 13:25:54 UTC
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/da2cf56892606fa81624f30dbbff3d2dbe77508b
Merge pull request #363 from jmdavis/redblacktree

Fix for Bug #6472. Make RedBlackTree's removeKey work with strings.