Embracing User-Defined Literals Safely

By Pablo Halpern

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.




Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.