[Issue 4883] std.algorithm functions conflict with std.string fucntions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 9 10:22:13 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4883


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com


--- Comment #3 from Jonathan M Davis <jmdavisProg at gmx.com> 2010-11-09 10:21:08 PST ---
The object.member notation is generally irrelevant unless it's actually a
member function. str.count("ab") will be changed to count(str, "ab") and any
overload resolution will be taken care of that way. The fact that count() is a
template function in std.algorithm and not in std.string probably doesn't help
any either, given how you can't currently overload functions where one is a
template and one not (though they'd be in different overload sets in this
case).

Regardless, using

alias std.string.count count;

should fix the problem, allowing you to use the string version without having
to write std.string.count(str, "ab"). Still, it would be better if std.string
and std.algorithm would avoid name clashes, since they're so likely to
conflict. At least some of the name clashes should be going away though as
functions are consolidated.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list