Embracing User Defined Literals Safely

Embracing User Defined Literals Safely

16:00 - 17:30 Wednesday 6th April 2022 BST



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 ""_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.

Your Privacy

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

Current Setting: Non-Essential Cookies REJECTED

By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED

Settings can be changed at any time from the Cookie Policy page.