The Many Faces of Number ⟷ String Conversions

Dvir Yitzchaki

90 minute session
11:00-12:30, Thursday, 7th July 2022

Seemingly a basic task, converting between numbers and their string representation is a problem which has kept C++ busy since its birth.

C++ inherited several library functions from C dealing with such conversions and has kept adding more on almost every new standard, the latest examples being to/from_chars from C++17 and C++20’s format library. This didn’t stop non-standard libraries, like Boost, from offering even more ways to do those conversions.

In this talk we will explore

  • std::atoi
  • std::stoi
  • std::to_string
  • std::from_chars
  • boost::lexical_cast
  • std::scan

and more. We will try to understand why the number-string conversion problem is being solved repeatedly, compare the API, implementation and performance of these utilities and see that, even now, there still room for improvement.


Dvir Yitzchaki

A senior software engineer at Yahoo/Edgecast, a conference speaker and a member of the Israeli National Body for C++ standardization.