Function reset


#include <include/flecs/addons/cpp/component.hpp>

void reset()


Reset static component variables. When components are registered their component ids are stored in a static type specific variable. This stored id is passed into component registration functions to ensure consistent ids across worlds.

In some cases this can be undesirable, like when a process repeatedly creates worlds with different components. A typical example where this can happen is when running multiple tests in a single process, where each test registers its own set of components.

This operation can be used to prevent reusing of component ids and force generating a new ids upon registration.

Note that this operation should never be called while there are still alive worlds in a process. Doing so results in undefined behavior.

Also note that this operation does not actually change the static component variables. It only ensures that the next time a component id is requested, a new id will be generated.


Lines 510-512 in include/flecs/addons/cpp/component.hpp.

inline void reset() {