boost-lexicalcast

Boost's lexical_cast From double to string Precision

痞子三分冷 提交于 2019-12-07 10:29:42
问题 I'm working with a library that unfortunately uses boost::lexical_cast to convert from a double to a string . I need to be able to definitively mirror that behavior on my side, but I was hopping to do so without propagating boost . Could I be guaranteed identical behavior using to_string , sprintf , or some other function contained within the standard? 回答1: The boost code ends up here: bool shl_real_type(double val, char* begin) { using namespace std; finish = start + #if defined(_MSC_VER) &&

Boost's lexical_cast From double to string Precision

杀马特。学长 韩版系。学妹 提交于 2019-12-05 13:43:41
I'm working with a library that unfortunately uses boost::lexical_cast to convert from a double to a string . I need to be able to definitively mirror that behavior on my side, but I was hopping to do so without propagating boost . Could I be guaranteed identical behavior using to_string , sprintf , or some other function contained within the standard? The boost code ends up here: bool shl_real_type(double val, char* begin) { using namespace std; finish = start + #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) sprintf_s(begin,