Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time
Jan 21, 2021
Jan 21, 2021
Jun 19, 2016


Language Standard License Gitter

Build and Test

DynaMix (Dynamic Mixins) is a new take on polymorphism. It lets the user compose and modify polymorphic objects at run time in C++.

The library is a means to create a project's architecture rather than achieve its purpose. It focuses on maximal performance and minimal memory overhead.

DynaMix is great for the software architecture of systems with very complex objects including, but not limited to:

  • Games (especially role-playing ones or strategies)
  • CAD systems
  • Enterprise systems
  • UI libraries

The library uses the type dynamix::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.

Here is a small example of what your code may look like if you use the library:

    // assuming my_objects.get_ally(0); is a way to get an ally to the
    // main character in a game
    dynamix::object& obj = my_objects.get_ally(0);

    // now let's make the object think some positive thoughts about the
    // main character

    think(obj); // C++ doesn't allow us to have obj.think().
                // DynaMix's messages are standalone functions

    // composition

    // object can now respond to fly()

    fly(obj); // ...instead of

    // mutation

    think(obj); // the same object now thinks negative thoughts about the main
                // character, since it's no longer an ally, but an enemy

Here are some of the key features of the library:

  • Compose objects from mixins at run time
  • Physically separate interface and implementation
  • Fast polymorphic calls – comparable to std::function
  • No external dependencies other than the standard library
  • Non-intrusive – mixins don't need to have a common parent or any special code inside
  • Mutate "live" objects by changing their composition at run time
  • Have multicast messages, which are handled by many mixins within an object
  • Possibility to have custom allocators to finely tune the memory and aim for cache-locality for critical parts of the code
  • Ability to have dynamic libraries that can enrich or modify objects, without modifying, or even rebuilding, the executable.
  • Thread safe message calls – as thread safe as the underlying methods.

You can also check out the talk about DynaMix from C++ Russia 2018 or the article about it in ACCU's Overload Journal from April, 2018.

C++ Russia video on YouTube

Created with DynaMix

The following projects are known to use DynaMix as a key piece of their software architecture:

There are two more known mobile games in development which use it. They will be added to this list upon release.


The full documentation is available at the GitHub page of the library


Several small fully working annotated tutorial programs are provided with the library:

  • Basic – a program which illustrates the basic usage of DynaMix. It's a tutorial on creating mixins and messages, and creating and modifying (or mutating) objects.
  • Messages – a tutorial which takes a deeper look at creating and calling the various types of messages.
    • Message bids – a tutorial which takes a deeper look at calling and overriding messages.
  • Mutation – a tutorial about the various ways by which objects can be created and mutated.
    • Mutation rules – a deeper look at the library's capabilities for automatic object mutation.
  • Combinators – a tutorial about handling the return type of multicast messages.
  • Allocators – a tutorial about using the library's mixin allocators.
  • Serialization – a tutorial which looks at the possibilities available for serializing objects.


There is an accompanying CMakeLists.txt file in the repo. Use CMake to generate project or make files for your desired platform and compiler.


Contributions in the form of issues and pull requests are welcome.


This software is distributed under the MIT Software License.

See accompanying file LICENSE or copy here.

Copyright © 2013-2021 Borislav Stanimirov, Zahary Karadjov


The DynaMix logo is licensed under a Creative Commons Attribution 4.0 International License. Copyright © 2018 area55git

License: CC BY 4.0.


DynaMix was initially developed as Boost.Mixin but is now a separate library, that doesn't depend on the Boost libraries Collection.

DynaMix, unlike Boost.Mixin, has no C++98 support. It's C++11 only.

DynaMix is distributed under the MIT license, whereas Boost.Mixin is distributed under the Boost Software License.