[Beast] std::to_string not available in gcc 4.8?
A user is complaining that std::to_string is not available in their
distribution. Beast doesn't support toolchains that don't have full
support for C++11. However, if this is the only thing missing maybe I
can just use a Boost equivalent to get him up and running.
I see boost::to_string in
A user is complaining that std::to_string is not available in their distribution. Beast doesn't support toolchains that don't have full support for C++11. However, if this is the only thing missing maybe I can just use a Boost equivalent to get him up and running.
I see boost::to_string in
is that a public interface? It doesn't look documented. What do folks typically do when they want to call std::to_string on an unsupported distribution?
My preferred alternative is boost::lexical_caststd::string. See http://www.boost.org/doc/libs/1_62_0/doc/html/boost_lexical_cast.html. As per my knowledge, boost::to_string is for internal usage. /TD This e-mail transmission (inclusive of any attachments) is strictly confidential and intended solely for the ordinary user of the e-mail address to which it was addressed. It may contain legally privileged and/or CONFIDENTIAL information. The unauthorized use, disclosure, distribution printing and/or copying of this e-mail or any information it contains is prohibited and could, in certain circumstances, constitute an offence. If you have received this e-mail in error or are not an intended recipient please inform the sender of the email and MillenniumIT immediately by return e-mail or telephone (+94-11) 2416000. We advise that in keeping with good computing practice, the recipient of this e-mail should ensure that it is virus free. We do not accept responsibility for any virus that may be transferred by way of this e-mail. E-mail may be susceptible to data corruption, interception and unauthorized amendment, and we do not accept liability for any such corruption, interception or amendment or any consequences thereof. www.millenniumit.com
On Wed, Nov 9, 2016 at 1:38 PM, Vinnie Falco
[...] What do folks typically do when they want to call std::to_string on an unsupported distribution?
boost::lexical_caststd::string()
On 9 November 2016 at 13:38, Vinnie Falco
A user is complaining that std::to_string is not available in their distribution. Beast doesn't support toolchains that don't have full support for C++11. However, if this is the only thing missing maybe I can just use a Boost equivalent to get him up and running.
A far better solution that boost::lexical_cast is the Boost.Convert 2.0 http://www.boost.org/doc/libs/1_62_0/libs/convert/doc/html/index.html library. You'll have full control, are able to choose your most optimal conversion method, avoids the clunky use of exceptions for checking if the conversion would be valid (which is obviously expensive) and you can choose (or custom implement) what happens if conversion is not possible (not necessarilly an exception). degski
On Fri, Nov 11, 2016 at 3:43 AM, degski
A far better solution that boost::lexical_cast is the Boost.Convert 2.0 http://www.boost.org/doc/libs/1_62_0/libs/convert/doc/html/index.html library.
Thank you, this looks great and its exactly what I needed. I had some concerns about lexical_cast and the inefficiencies of exceptions for my simple use case. This is one of the great things I love about having Boost as a monolithic distribution, it has a wonderful collection of (mostly header-only) libraries that I can just reach for as needed without fussing about dependencies.
participants (4)
-
degski
-
Dissanayake, Tharindu
-
Dominique Devienne
-
Vinnie Falco