This has been discussed several times on the mailing list, but a unified decision has not yet been made. You can use the following placeholder function until then, however, due to an exception, without creating either style or efficiency:
template<typename Target, typename Source> inline Target default_numeric_cast(Source arg, Target def) { try { return numeric_cast<Target,Source>(arg); } catch (...) { return def; } }
However, a custom solution will be more efficient.
source share