Photo of Simon Brand

Simon Brand

Simon is Microsoft's C++ Developer Advocate, working on bettering our communities and making the lives of developers easier. They have an unhealthy love of template metaprogramming and the dark corners of the language

How to Write Well-Behaved Value Wrappers

Tuesday 11:00
60 minute presentation
Advanced
Intermediate

There are many useful generic types which wrap a number of values up into one object, e.g. std::optional or std::tuple. These types are conceptually very simple, but designing and implementing them to be as optimal and consistent as possible is deceptively difficult. This talk will outline key considerations, show why they matter by examining the assembly generated from compilers, and describe a number of solutions for problems which arise. Finally, a number of C++ standards papers which could ease the implementation burden for these types will be discussed.

Topics covered will include implicit/explicit constructors, conditional deletion of special member functions, propagation of special member triviality, noexcept correctness, private inheritance, ref-qualified member functions, and comparison operators.