[Issue 8851] std.string.join should allow 'char' as joiner
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 19 02:36:44 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8851
monarchdodra at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |monarchdodra at gmail.com
--- Comment #2 from monarchdodra at gmail.com 2012-10-19 02:36:28 PDT ---
(In reply to comment #1)
> I expect that this stems from the stupidity of character literals defaulting to
> char rather than dchar, and when you couple that with the fact that templates
> always use the _exact_ type of what you give them, it's going to try and
> instantiate join with a separator of char, which doesn't work with ranges of
> dchar. I'm not sure how you'd go about fixing that.
I investigated, and that's not it.
It's *just* that std.array.join, like std.algorithm.joiner, expects the
separator to be a range.
The enhancement request here would be for both "std.array.join"
std.algorithm.joiner" to accept a single element as a separator.
In the meantime, of course, a simple workaround is to just "join([sep])".
I think this needlessly allocates a 1 element array though, no?
--------
On a side note, the current restrictions in join are overly restrictive,
requiring an exact match, making this illegal:
int[] sep = [1];
double[] z = [[0.1], [0.2]].join(sep);
When it is perfectly supported: joiner supports it.
--
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