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