Nothrow std.conv.to with explicit default value
Steven Schveighoffer
schveiguy at yahoo.com
Mon Jun 18 21:10:03 UTC 2018
On 6/18/18 4:48 PM, Per Nordlöw wrote:
> The problem with this code is that throwing exceptions for the default
> case is costly at least with dmd. Is there another way to do this?
Yes, have an internal implementation which doesn't throw, but rather
returns an error code. Then you can call that and throw or use default
value based on the return value.
It just means re-doing std.conv.to, which is pretty hairy, but also
pretty well-organized.
-Steve
More information about the Digitalmars-d-learn
mailing list