On 05/20/2014 07:15 PM, Rob Stewart wrote:
I don't mind the clear separation of the input and output types, but if "from" can be avoided easily, do so.
Encouraged ;-) I could not resist the itch and got rid of "::from". Updated the code and the docs.
Shorter is better when clarity is not lost, but I'm unclear on the need to specify the input type.
Indeed, it's not needed as often. Still, sometimes we might want to
force a particular type:
boost::cstringstream_converter cnv;
boost::convert<string>(-1, cnv).value() == "-1";
boost::convert
boost::cnv
(cnv).value_or(-1); boost::lexical_cast ("char string"); I haven't begun my review yet, though I intend to do so, so I might find the answer myself, but why is it necessary to specify "string" in that example? Can the converter be expected to understand a string literal as well as a std::string?
Indeed, that was a bad example and the explicit specification of in-type was not necessary.