Range-Based Text Formatting - For a Future Range-Based Standard Library

Arno Schoedl

60 minute presentation
advanced
intermediate
11:00-12:00, Friday, 2nd July 2021

Text formatting has been a favorite problem of C++ library authors for a long time. In this talk, I want to convince you that the combination of ranges with a bit of metaprogramming makes for a very elegant solution to the text formatting problem. We introduce a form of ranges with internal iteration, which are generating their elements one by one rather than exposing external iterators. We can use these generator ranges to represent the values to be formatted, conceptually turning them into lazily evaluated strings. These can be used just like regular strings are used today: in function returns; as standard algorithm input; embedded into other, equally lazily evaluated strings; and so on, before they are finally expanded into a container. By choosing the right interfaces, we can optimize this expansion to the point that it is only 15% slower than creating the equivalent string using hand-optimized special-case code.

Arno Schoedl

think-cell Founder & CTO

Arno is responsible for the design, architecture and development of all our software products. He oversees think-cell's R&D team, Quality Assurance and Customer Care.

Before founding think-cell, Arno worked at Microsoft Research and McKinsey. Arno studied computer science and management and holds a Ph.D. from the Georgia Institute of Technology with a specialization in Computer Graphics.