[ Ссылка ]
Discussion & Comments: [ Ссылка ]
Presentation Materials: [ Ссылка ]
—
TMI on UDLs: Mechanics, Uses, and Abuses of User-Defined Literals - Stephen Dewhurst - CppCon 2019
We’ve been designing user-defined types in C++ forever, but we were stuck with the same old predefined literal types that somehow had to suit our new concepts. We’d use constructors to beat them into compliance with our new concepts, but we were still just pretending that a double floating-point value had something to do with a kilogram.
C++11 introduced user-defined literals, and C++14, C++17, and C++20 have extended their convenience. In this brisk talk, we’ll look at the mechanics of all six varieties of user-defined literals and use them in a straightforward way to enhance usability and correctness of our user-defined types, and banish type sinks from our interfaces. Along the way, we'll see what the standard lets us get away with and what it doesn't.
Then we’ll see how to force people to write their integers in base 5, require that literals adhere to a particular syntax, deal with those pesky 256-bit integers, and circumvent problems with octals. Time permitting, we’ll see some unusual and possibly useful things we can do with user-defined literals.
—
Stephen Dewhurst
Steve Dewhurst is the co-founder and president of Semantics Consulting, Inc. Steve is the author of numerous technical articles on C++ programming techniques and compiler design, is the author of the critically acclaimed books C++ Common Knowledge and C++ Gotchas, and is the co-author of Programming in C++. He is a frequent speaker at industry conferences, where his presentations are consistently among the most popular and highest rated. He is also a member of the advisory board for The C++ Source, was programming track chair for the Embedded Systems Conference (ESC), and was a visiting scientist at the Software Engineering Institute (SEI) at Carnegie Mellon University. Steve has mentored and consulted with C++ projects ranging in size from 1 to over 100 developers, in areas ranging from compiler design to embedded telecommunications to ecommerce to derivative securities trading. As a Member of Technical Staff in the UNIX Development Laboratory at AT&T Bell Laboratories, Steve worked with Bjarne Stroustrup, the designer and first implementer of C++, on the first public release of the language and cfront C++ compiler, then served as the lead designer and implementer of the first non-cfront C++ compiler. As a compiler architect at Glockenspiel, Ltd., he designed and implemented a second C++ compiler. Steve was a contributing editor for The C/C++ User's Journal, a principal lecturer at The C++ Seminar, has served as a principal on the ANSI/ISO C++ standardization committee, was the C++ training series adviser for Technology Exchange Company (Addison-Wesley), was a member of the editorial board of and columnist for C++ Report, co-founder and member of the editorial board of The C++ Journal, and a Visiting Professor of Computer Science at Jackson State University. He has also written C, COBOL, and Pascal compilers, was a principal on the ANSI/IEEE Pascal Standardization Committee, and a reviewer for ACM Computing Reviews. Semantics Consulting, Inc. is located in the small New England town of Carver, Massachusetts. Like all small New England towns, Carver has a tradition of citizen involvement, and over the years Steve has been astonished to find himself harvesting cranberries, coaching the high school wrestling team, and serving on the town water commission, finance committee, and website committee.
—
Videos Filmed & Edited by Bash Films: [ Ссылка ]
*-----*
Register Now For CppCon 2022: [ Ссылка ]
*-----*
Ещё видео!