In Search of the Perfect Return: A C++ Programming Journey

Walter E Brown

⏱ 90 minute session
intermediate
advanced
17:00-18:30, Monday, 23rd June 2025

Marcel Proust wrote (trans.) that "The true voyage of discovery... is not a journey to a new place; it is learning to see with new eyes." Accordingly, in the first part of this talk, we’ll explore a targeted selection of C++ features whose surface behaviors are already familiar to most of us. However, we’ll seek deeper insights and understanding not commonly taught or considered. Topics to be examined in depth with "new eyes" will include selected aspects of: ∙ cross-type comparison, ∙ decltype(auto), ∙ move semantics and perfect forwarding, ∙ partially-ordered types, ∙ qualifier unification, ∙ static_cast and function call expressions, ∙ ternary operator vis-a-vis reference types, ∙ value categories, and more.

Once we've finished discussing C++ features, we’ll explore a generic C++ programming problem that I've dubbed the "imperfect return." Because this issue has affected a number of standard and nonstandard algorithms for a long time now, we’ll examine how and why traditional design and code remains unsatisfactory.

Finally, after looking at some solutions that have been proposed in the past, we’ll apply the discussed C++ features in conventional and less-conventional ways, to solve the long-standing "imperfect return" problems. Best of all, the result (including all boilerplate) will comprise remarkably few lines of code!

Come and see the evolution of a new idiom, the "perfect return"!

Walter E Brown

With broad experience in industry, academia, consulting, and research, Dr. Walter E. Brown has been a computer programmer for more than 60 years, and a C++ programmer for over 40 years.

He joined the C++ standards effort in 2000, and has since written circa 175 proposal papers. Among numerous other contributions, he is responsible for introducing such now-standard C++ library features as cbegin/cend, common_type, gcd/lcm, void_t, and <cmath>’s mathematical special functions, as well as the headers <random> and <ratio>. He has also significantly impacted such C++ core language features as alias templates, contextual conversions, variable templates, static_assert, and operator<=> (the C++20 “spaceship operator”).

When not playing with his grandchildren, Dr. Brown continues as an Emeritus participant in the C++ standards process and as a frequent speaker at C++ meetups and conferences worldwide.