boost::lexical_cast 在将字符串转换为 int8_t 时抛出异常,但 int32_t - norm。
int8_t 有什么问题?
#include <iostream>
#include <cstdlib>
#include <boost/lexical_cast.hpp>
int main()
{
try
{
const auto a = boost::lexical_cast<int8_t>("22");
std::cout << a << std::endl;
}
catch( std::exception &e )
{
std::cout << "e=" << e.what() << std::endl;
}
}