Function get_stage


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

flecs::world get_stage(int32_t stage_id) const


Get stage-specific world pointer. Flecs threads can safely invoke the API as long as they have a private context to write to, also referred to as the stage. This function returns a pointer to a stage, disguised as a world pointer.

Note that this function does not(!) create a new world. It simply wraps the existing world in a thread-specific context, which the API knows how to unwrap. The reason the stage is returned as an ecs_world_t is so that it can be passed transparently to the existing API functions, vs. having to create a dediated API for threading.


stage_id - The index of the stage to retrieve.

A thread-specific pointer to the world.


Lines 381-383 in include/flecs/addons/cpp/world.hpp.

flecs::world get_stage(int32_t stage_id) const {
    return flecs::world(ecs_get_stage(m_world, stage_id));