Default-valued nothrow @nogc std.conv:to
Stanislav Blinov via Digitalmars-d
digitalmars-d at puremagic.com
Sat Apr 22 15:42:22 PDT 2017
On Saturday, 22 April 2017 at 12:16:19 UTC, Nordlöw wrote:
> On Saturday, 22 April 2017 at 12:14:26 UTC, Nordlöw wrote:
> If I get this to work, I'm gonna try pushing it into std.conv.
Another bit to pick on is the return value.
auto x = toWithDefault!int("1", 0.0f);
typeof(x) will be float even though the caller requested a
conversion to int.
Probably should be
T toWithDefault(T,S,U)(S v, /*lazy*/ U defaultValue)
if (is(typeof(() { T r = defaultValue; })))
{
//...
}
More information about the Digitalmars-d
mailing list