tryTo: non-throwing variant of std.conv.to

Per Nordlöw per.nordlow at gmail.com
Wed Aug 15 09:21:29 UTC 2018


Have anybody thought about non-throwing variants of std.conv.to 
typically named `tryTo`
similar to what Folly

https://github.com/facebook/folly/blob/master/folly/docs/Conv.md#non-throwing-interfaces

does, for instance, as

     tryTo<int>(str).then([](int i) { use(i); });

?

Would it be sane to add these to std.conv alongside existing 
std.conv.to so that underlying logic in std.conv.to can be reused?

If so, AFAICT, existing std.conv.to should be implemented on top 
of std.conv.tryTo.


More information about the Digitalmars-d-learn mailing list