Subject: Re: [boost] [review] Convert library
From: feverzsj (feverzsj_at_[hidden])
Date: 2014-05-25 14:04:21
I agree the converter concept is a step forward. And it's also a good idea to
support both exception and defualt value on failure. The functor interface
is useful, too.
But as other reviewer mentioned, the convert interface seems less intuitive
and lack a default convenient interface.
Personally, I'd prefer something like:
// cast like interface
T t = conv_to<T>(from, cnv); // compare to T t =
T t = conv_to<T>(from, default_v, cnv); // compare to T t =
// plain interface
bool re = convert(from, to, cnv);
// functor interface
std::transfrom(first, last, out, convert<T>(from, cnv)));
std::transfrom(first, last, out, convert<T>(from, default_v, cnv)));
** with defualt interface version, "cnv" will be ignored
Using only two names, we can get something simple and intuitive. The
implemention can be also effectively simplfied.
-- View this message in context: http://boost.2283326.n4.nabble.com/review-Convert-library-tp4662821p4662845.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk