Boost.Mixin is a library that allows the composition and modifications of polymorphic types at run time. Types and objects are constructed out of building blocks called mixins enabling an effect similar to multiple inheritance, while allowing the client code to remain oblivious to the actual composition of the objects.

A take on the Composition over inheritance technique, the result closely resembles the popular pattern entity-component-system, or the mixins in Ruby. It can also be compared to the inheritance in Eiffel or the traits in Self, Scala, PHP, and many others, or the roles in Perl.

This is given while also having full abstraction between the interface and the definition of types – a problem often given as the motivation for the PIMPL idiom.

In short, Boost.Mixin is an alternative way to accomplish polymorphism.

The library uses the type boost::mixin::object as a placeholder, whose instances can be extended with existing classes (mixins), thus providing a particular instance with the functionality of all those types. Accessing the newly formed type's interface is made through messages – stand-alone functions generated by the library, which can be thought of as methods.

Boost.Mixin focuses on maximal performance and minimal memory overhead.

Other meanings of "mixin" in C++ The name "Mixin" is not to be confused with another meaning, popular in C++, namely CRTP mixins. This particular use of CRTP in this document shall henceforth be referred to as "traits", as the exact same functionality is called "traits" in many other languages.

Other meanings of "mixin" in other languages In D the term mixin exists and mixin is a keyword. It is a compile time feature, that has some similarities with the macros in C and C++, and none at all with Boost.Mixin. It is a completely different concept.