http://d.puremagic.com/issues/show_bug.cgi?id=4716
Summary: std.stdio.input() or similar Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2010-08-22 20:02:39 PDT --- If not already present, a function template similar to this one may be useful for the std.stdio module. Similar functions are present in Basic and Python languages: T input(T)(string msg) { write(msg); auto read = readln(); static if (!is(T == string) && !is(T == dstring) &&!is(T == wstring)) read = read.strip(); return to!T(read); } To be used mostly in scripts, as: double x = input!double("Enter value x: "); Its name may be changed if there is collision with something different, but it needs to be simple, given its purpose. This function may be made much more refined, but I suggest to keep it simple. Even the static if it contains is more complex than originally thought. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------