lexical_cast int to string

前端 未结 3 1521
耶瑟儿~
耶瑟儿~ 2021-02-19 16:22

Is it safe to ignore exception of boost::lexical_cast when converting int to std::string?

3条回答
  •  囚心锁ツ
    2021-02-19 17:15

    As you say, I don't believe the cast can fail for the numerical types for conversion reasons - it can still fail because the string cannot be allocated, of course, but people don't normally catch that error except at the highest level of their code.

提交回复
热议问题