[Issue 6231] [patch] std.conv.to/std.format.: Structs with toString and isInputRange match multiple templates.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jun 30 12:09:06 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6231
Rob Jacques <sandford at jhu.edu> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[patch] std.conv.to: |[patch]
|Structs with toString and |std.conv.to/std.format.:
|isInputRange match multiple |Structs with toString and
|templates. |isInputRange match multiple
| |templates.
--- Comment #1 from Rob Jacques <sandford at jhu.edu> 2011-06-30 12:04:07 PDT ---
std.format.formatRange also suffers from a similar problem, although in this
case it is one of choosing a non-character range over the custom toString
routine.
[Line 1171 in format.d in DMD 2.053]
void formatValue(Writer, T, Char)(Writer w, T val,
ref FormatSpec!Char f)
if (isInputRange!T && !isSomeString!T
The extra condition:
&& !(is(T == struct) && is(typeof(&T.init.toString))) )
And the toString exception needs to added to Line 1474
void formatValue(Writer, T, Char)(Writer w, T val,
ref FormatSpec!Char f)
if (is(T == struct) && (!isInputRange!T || is(typeof(&T.init.toString))) )
By the way, I like the idea of
void toString(void delegate(const(char)[]) sink, FormatSpec fmt);
void toString(void delegate(const(char)[]) sink, string fmt);
but are which one is preferred? And if/when is Object going to switch over?
--
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