Boost logo

Boost :

Subject: Re: [boost] Boost review of the Convert library is ongoing
From: Vladimir Batov (vb.mail.247_at_[hidden])
Date: 2014-05-16 19:54:07


Vladimir Batov <vb.mail.247 <at> gmail.com> writes:
> alex <alexhighviz <at> hotmail.com> writes:
...
> RE#4: The following is not compiling because of the way it uses enable_if in
> sstream.hpp.
>
> boost::cstringstream_converter cnv;
> std::string str = boost::convert<std::string >::from("hello", cnv).value();
>
> JUSTIFICATION: It's not compiling because applying std::stringstream to such
> a trivial type transformation is wasteful.
>
> TODO: Add "char const*->std::string" transformation specialization to
> sstream-based converter.

Hmm, now I am not sure if I agree with my own "justification". :-) What if I
want to apply std::sstream-provided formatting facilities to convert from,
say, a "0xFF" hex string to a decimal string? Is it one of "char
const*->std::string" transformations that you had in mind? I've never
thought of this and never tried... will it even work with std::sstream?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk