Bug 6472 – RedBlackTree.removeKey

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-08-11T19:01:00Z
Last change time
2012-02-10T06:53:39Z
Assigned to
nobody
Creator
ellery-newcomer

Comments

Comment #0 by ellery-newcomer — 2011-08-11T19:01:44Z
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 by issues.dlang — 2011-08-11T21:05:21Z
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 by issues.dlang — 2011-12-10T23:26:09Z
Comment #3 by github-bugzilla — 2012-02-05T13:25:54Z
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.