Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor IdRegistryStl for loops #283

Closed
Capital-Asterisk opened this issue May 26, 2024 · 1 comment
Closed

Refactor IdRegistryStl for loops #283

Capital-Asterisk opened this issue May 26, 2024 · 1 comment
Labels
good first issue Good for newcomers refactor Self explanatory tag name

Comments

@Capital-Asterisk
Copy link
Contributor

Something to do. This doesn't require too much knowledge of how everything works. Depends on #281, this issue is mostly copied from it.

IdRegistryStl now has iterators. Iterating all possible IDs previously looks something like this:

for (std::size_t const drawEntInt : rScene.m_scnRdr.m_drawIds.bitview().zeros())
{
    auto const drawEnt = DrawEnt(drawEntInt);
    // do something with drawEnt
}

This works because IdRegistryStl is internally just a bit view / bitvector; ones bits are used for free IDs, and zeros bits are used for existing ones. There are countless instances of this in the code (search for "bitview().zeros()"), which can now be replaced with:

for (DrawEnt const drawEnt : rScene.m_scnRdr.m_drawIds)
{
    // do something with drawEnt
}

Task:

Search the entire codebase for ".bitview().zeros()". Then refactor like above.

@Capital-Asterisk Capital-Asterisk added good first issue Good for newcomers refactor Self explanatory tag name labels May 26, 2024
@Capital-Asterisk
Copy link
Contributor Author

Fixed in #286. Thanks, Lamakaio!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers refactor Self explanatory tag name
Projects
None yet
Development

No branches or pull requests

1 participant