...

/

Elementary string conversions

Elementary string conversions

This lessons discusses the shortcomings of the string conversion functions present in older versions of C++ and the new more efficient string manipulation functions introduced in C++ 17.

The growing number of data formats like JSON or XML require efficient string processing and manipulation. The maximum performance is especially crucial when such data formats are used to communicate over the network, where high throughput is the critical factor.

For example, you get the characters in a network packet, you deserialise it (convert strings into numbers), then process the data, and finally, it’s serialised back to the same file format (numbers into strings) and sent over the network as a response.

The Standard Library had bad luck in those areas. It’s usually perceived to be too slow for such advanced string processing. Often developers prefer custom solutions or third-party libraries.

The situation might change as with C++17 we get two sets of functions: from_chars and to_chars that allow for low-level string conversions.

Current Solutions Summaries Table

...