Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.
This repository was archived by the owner on May 20, 2026. It is now read-only.

base/registry: introduce empty() const method #5875

Description

@skalk

For several times I tumpled over the Genode::Registry having no method to check whether it is empty or not. The typical workaround is to use do something like:

bool empty = true;
my_registry.for_each([&] (auto&) { empty = false; });

This is not nice to read, nor efficient. Of course, I can derive from Registry and implement empty, but here again I can only iterate over all items to check for it, because the internally used List is completely hidden for derivates too.
Therefore, I would like to add something like the following to base/include/base/registry.h to the Genode::Registry class:

bool empty() const
{
    return !_elements.first();
}

@nfeske do you agree?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions