Mixins in Operator Overloading and Destructors
You will learn about the use of string mixins in operator overloading and in destructors in this lesson.
We'll cover the following
String mixins in operator overloading
We have seen in the operator overloading chapter how mixin expressions helped with the definitions of some of the operators.
In fact, the reason why most operator member functions are defined as templates is to make the operators available as string values so that they can be used for code generation. We have seen examples of this both in that chapter and its exercise solutions.
Mixed in destructors
It is possible to mix in multiple destructors in a user-defined type. Those destructors are called in the reverse order of the mixin statements that added them. This feature allows mixing in different resources to a type, each introducing its own cleanup code.
Get hands-on with 1200+ tech skills courses.