By Nina Ranns
What’s trivial about trivial types ? What can we say about the layout of the standard layout types? What is the lifetime of an implicit-lifetime type ? How are all these types different from aggregate types, literal types, and structural types? Why do we need them, and when do we care ? Everything you wanted to know about C++ user type categories and more.
Modern C++ offers several new classification of user defined types that are in certain contexts treated like built-in types. Getting familiar with them will allow you to take advantage of the special provisions the language gives you and write better code. Knowing the boundaries of those specific situations will prevent you from falling into the UB abyss. Join me as we take a tour of language recognised user types, noting their advantages and pitfalls.