On 05/18/2014 11:45 PM, Vladimir Batov wrote:
Vladimir Batov
writes: Andrzej Krzemienski
writes: I personally do not like this trick to force me to type this "from" in "convert<int>::from". I just had another look and there seems no value anymore in potential specializations on TypeIn, TypeOut. It's because all the "smartness" and type-handling has been moved to converters. So, *there seems*, the "from" can be dropped. That is,
int v = boost::convert<int>(str, cnv).value();
instead
int v = boost::convert<int>::from(str, cnv).value();
and
std::transform( strings.begin(), strings.end(), std::back_inserter(integers), convert
(ccnv(std::hex)).value_or(-1)); instead
std::transform( strings.begin(), strings.end(), std::back_inserter(integers), convert<int>::from<string>(ccnv(std::hex)).value_or(-1));
I am on the fence (the "from" has been with me for some time). Any strong/weak :-) preferences, any for/against arguments?
Given a few people were not happy with boost::convert::from() interface
I've added boost::cnv() for now (so that the names do not clash while
both exist).
int v = boost::cnv<int>(str, cnv).value();
does look cleaner and somewhat similar to lexical_cast deployment (for
better or worse). However, I feel similarly confused about
boost::cnv