[Issue 1487] New: toString(string) and toString(Object)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 9 11:41:41 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1487
Summary: toString(string) and toString(Object)
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P4
Component: Phobos
AssignedTo: bugzilla at digitalmars.com
ReportedBy: dhasenan at gmail.com
For convenience, std.string should provide toString overloads that accept
char[], const(char)[], and Object. Currently, for generic template code, you
have to do the following:
---
import std.string;
alias std.string.toString toString;
string toString(Object o) { return (o ? o.toString : "null"); }
string toString(string s) { return s; }
template (T) {
T t;
// ...
toString(t);
}
---
--
More information about the Digitalmars-d-bugs
mailing list