Boost's lexical_cast From double to string Precision
问题 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) &&