What's the difference between std::to_string, boost::to_string, and boost::lexical_cast<std::string>?
问题 What's the purpose of boost::to_string (found in boost/exception/to_string.hpp ) and how does it differ from boost::lexical_cast<std::string> and std::to_string ? 回答1: std::to_string, available since C++11, works on fundamental numeric types specifically. It also has a std::to_wstring variant. It is designed to produce the same results that sprintf would. You may choose this form to avoid dependencies on external libraries/headers. The throw-on-failure function boost::lexical_cast<std::string