1) I do like
T t = convert<T>(from, cnv); // Throws on failure T t = convert<T>(from, default_v, cnv); // Returns 'def' on failure
and, if my memory serves me, that was pretty much review#1 interface (minus converters). What it misses though is handling one use-case -- deterministic non-throwing handling of conversion failure. When #2 returns default_v, we do not know if it is due to a failure or "from" just happened to convert to "default_v".
Using a default value means user knows the default value won't be a valid input or it is used as a fallback or just not cared. If conversion failure must be explicitly catched, other interface should be used.
2) I can see two potential problems with a converter provided by default:
a) it might be tricky separating
convert(TypeIn const&, Converter const& =some_default()); convert(Converter const& =some_default());
how about write another overload: convert(TypeIn const&, Converter const&); convert(TypeIn const&); // using default converter
b) different people might feel quite strongly what converter to be the default... and I'll be on the receiving end of their fury. :-(
A default converter may be used in most of the daily job. It's important for boost lib to offer such convenience. If one wants different converter, he can always make himself one. regards. -- View this message in context: http://boost.2283326.n4.nabble.com/review-Convert-library-tp4662821p4662859.... Sent from the Boost - Dev mailing list archive at Nabble.com.