Breaking Dependencies - C++ Type Erasure - The Implementation Details - Klaus Iglberger CppCon 2022

Discover the power of C++ type erasure, learn how to decouple interfaces from implementations, and improve code design flexibility and efficiency in this insightful talk.

Key takeaways
  • The talk discusses the concept of type erasure in C++ and its advantages.
  • Type erasure is used to decouple the interface of a class from its implementation.
  • It eliminates the need for inheritance and allows for more flexibility in code design.
  • The talk introduces the concept of “affordances” which refers to the operations that a class provides.
  • The speaker explains how type erasure can be used to create a base class that can be extended by any shape class.
  • The talk discusses the concept of “move operations” and how they can be used to improve the efficiency of code.
  • The speaker also mentions the importance of using const references to avoid unnecessary copying.
  • The talk introduces the concept of “small buffer optimization” which is a technique used to improve the efficiency of code by using a small buffer instead of dynamic memory allocation.
  • The speaker discusses the concept of “ prototypes” which are used to create a base class that can be extended by any shape class.
  • The talk also mentions the importance of using a proper naming convention to make the code more readable.
  • The speaker explains how type erasure can be used to create a base class that can be extended by any shape class.
  • The talk discusses the concept of “value semantics” which refers to the idea that objects should behave like values.
  • The speaker also mentions the importance of using a proper return type to avoid unnecessary copying.
  • The talk introduces the concept of “run-time type identification” which is used to determine the type of an object at run-time.
  • The speaker discusses how type erasure can be used to improve the flexibility of the code.
  • The talk also mentions the importance of using a proper naming convention to make the code more readable.
  • The speaker explains how type erasure can be used to create a base class that can be extended by any shape class.
  • The talk discusses the concept of “polymorphism” which is the ability of an object to take on multiple forms.
  • The speaker also mentions the importance of using a proper naming convention to make the code more readable.
  • The talk introduces the concept of “flyweight pattern” which is used to reduce the memory overhead of objects.
  • The speaker discusses how type erasure can be used to improve the efficiency of the code.
  • The talk also mentions the importance of using a proper naming convention to make the code more readable.
  • The speaker explains how type erasure can be used to create a base class that can be extended by any shape class.
  • The talk discusses the concept of “composite pattern” which is used to combine objects into a single object.
  • The speaker also mentions the importance of using a proper naming convention to make the code more readable.
  • The talk introduces the concept of “visitor pattern” which is used to add new behavior to objects.
  • The speaker discusses how type erasure can be used to improve the flexibility of the code.
  • The talk also mentions the importance of using a proper naming convention to make the code more readable.
  • The speaker explains how type erasure can be used to create a base class that can be extended by any shape class.
  • The talk discusses the concept of “iterator pattern” which is used to create a way to iterate over objects.
  • The speaker also mentions the importance of using a proper naming convention to make the code more readable.
  • The talk introduces the concept of “adaptor pattern” which is used to adapt the interface of an object.
  • The speaker discusses how type erasure can be used to improve the flexibility of the code.
  • The talk also mentions the importance of using a proper naming convention to make the code more readable.
  • The speaker explains how type erasure can be used to create a base class