C++ Regular, Revisited - Victor Ciura - CppCon 2023

C++ expert Victor Ciura revisits the concept of regular types, highlighting the importance of clear value and object definitions, and exploring the implications for generic programming, type design, and more.

Key takeaways
  • Define values and objects clearly, and avoid confusing them.
  • Regular types are those that model built-ins most closely and have no dependent types.
  • STL assumes equality is always defined, or at least an ad hoc predicate.
  • Equality is a special case of equivalence, and formally we say that equality implies representational format.
  • Value is the datum together with its interpretation.
  • Objects are representations of concrete entities as a combination of datums and operations.
  • When defining values, ordering, and equality, it’s important to consider the mathematical tradition and mathematical education.
  • The concept of generic programming depends on decomposition of programs into smaller parts.
  • C++20 concepts formalize some of the requirements for types.
  • Span is a type that is not good to be stored in data structures or safely returned from functions.
  • String view has a comparator, but it’s not good to be stored in data structures or safely returned from functions.
  • When designing a class type, consider the properties and what properties can be used to describe types.
  • Use the concept of regular types to model built-ins most closely and have no dependent types.
  • C++ programmers should be aware of the importance of defining values and objects clearly.
  • Define equality beyond the syntax and language boilerplate.
  • Consider the lifetime extension and const protection when designing types.
  • Use the concept of equivalence to compare and sort things.
  • Define values and objects clearly to avoid confusing them.
  • Consider the mathematical tradition and mathematical education when defining values, ordering, and equality.
  • The concept of generic programming depends on decomposition of programs into smaller parts.
  • C++20 concepts formalize some of the requirements for types.
  • Use the concept of regular types to model built-ins most closely and have no dependent types.
  • C++ programmers should be aware of the importance of defining values and objects clearly.
  • Define equality beyond the syntax and language boilerplate.
  • Consider the lifetime extension and const protection when designing types.
  • Use the concept of equivalence to compare and sort things.