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

Explore viability/necessity for creating our own container types #177

Open
malleoz opened this issue Nov 22, 2024 · 2 comments · May be fixed by #239
Open

Explore viability/necessity for creating our own container types #177

malleoz opened this issue Nov 22, 2024 · 2 comments · May be fixed by #239
Labels
engine Code involving engine (C++) feature New code P3 Priority: Low

Comments

@malleoz
Copy link
Contributor

malleoz commented Nov 22, 2024

This is mainly regarding std::vector. We use vectors throughout Kinoko, even though Nintendo didn't have them. What we end up effectively having is some container always having a fixed upper bound, whereas std::vector is resizable. We could use spans, but then it's annoying to have to manage that every time we run into this scenario.

Explore why we should make our own container type and discuss some of the unique implementation details we could include, such as having ASSERTs in our push_back / emplace_back calls.

@vabold
Copy link
Owner

vabold commented Nov 22, 2024

std::span is only usable when the size and capacity of an array are the same. std::vector allows for incongruency between size and capacity, but handles cases in which the size can be greater than the capacity. We would prefer a container that guarantees the size will always be below or at a specified capacity, thus eliminating a lot of overhead.

@vabold
Copy link
Owner

vabold commented Nov 30, 2024

We can also port eggBuffer.hh, which is an owning span.

@vabold vabold added engine Code involving engine (C++) P3 Priority: Low feature New code labels Nov 30, 2024
@vabold vabold linked a pull request Jan 12, 2025 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine Code involving engine (C++) feature New code P3 Priority: Low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants