Skip to content

Sorting view #5

@ilumary

Description

@ilumary

I've tried sorting a view by entity id, however that does not work. What would be the correct way to sort entities without copying them?

auto view = registry.view<const ecs::entity&>().each()
std::sort(view.begin(), view.end(), [](std::tuple<const ecs::entity&> a, std::tuple<const ecs::entity&> b){
    return std::get<0>(a).id() < std::get<0>(b).id();
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions