Embracing User Defined Literals Safely
A fundamental design goal of C++ is to minimize the expressive differences between built-in types and user-defined types (UDTs). Just as we can overload `operator+` for our UDT, we can also specify a syntax for creating a value of that type; think `123_bigint` or `"[a-z]*"_regexp`. But just because we *can* overload an operator or create a user-defined literal (UDL), doesn't mean that we *should* do so. In this talk, we will cover the benefits of UDLS, several ways of defining them (each more powerful and complex than the one before), some best practices, and -- most importantly -- the pitfalls of defining one's own UDLs and when *not* to.
Pablo Halpern
Member of the C++ Standards Committee. Self employed software developer, Boston, MA, USA.