[Issue 4317] New: Calling std.string.split with static array for separator fails to compile
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jun 14 23:53:00 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4317
Summary: Calling std.string.split with static array for
separator fails to compile
Product: D
Version: D2
Platform: All
OS/Version: Windows
Status: NEW
Severity: minor
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: jpowers at wyrdtech.com
--- Comment #0 from jpowers at wyrdtech.com 2010-06-14 23:52:59 PDT ---
Using D 2.047, get a template error at compilation from std.algorithm when
calling split with a static array as the separator.
The following code:
module main;
import std.string;
void main() {
char[3] foo = "t n";
string[] sa = split("split me now", foo);
}
fails with:
...phobos\std\algorithm.d(796): Error: template std.range.retro(R) if
(isBidirectionalRange!(R)) does not match any function template declaration
...phobos\std\algorithm.d(796): Error: template std.range.retro(R) if
(isBidirectionalRange!(R)) cannot deduce template function from argument types
!()(char[3u])
This means the character sets provided in std.string cannot be used, i.e.
split("some string", whitespace)
will fail. Using an immutable array (as the char sets are) surfaces an
additional compiler error:
...phobos\std\algorithm.d(804): Error: slice this._separator[] is not mutable
Think there are actually two issues here, though fixing one likely fixes the
other:
1. It doesn't work (see above).
2. Errors reported are rather difficult to track back to cause - there is no
indication of what originally triggered the algorithm/range code.
--
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