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

stb_ds.h: add arrclear(), cast values to ptrdiff_t in arrsetlen() comparision #1175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cajomar
Copy link

@cajomar cajomar commented Jul 16, 2021

Pull request for issue #1170.

@cajomar cajomar changed the title Add arrclear(), cast values to ptrdiff_t in arrsetlen() comparision stb_ds.h: add arrclear(), cast values to ptrdiff_t in arrsetlen() comparision Jul 16, 2021
@mohad12211
Copy link

can something similar to this be used for the hashmap?
setlen to zero but keep the allocated memory (capacity) for further use?

@DontStopThinking
Copy link

DontStopThinking commented Jan 2, 2025

This has been open for a while, any update on getting it merged please? I think being able to clear an array without freeing the allocated memory is a common use case, so it'd be useful to have this in stb_ds. Especially, since std::vector also has it with its clear() method.

Moreover, would it be worth adding some tests inside stbds_unit_tests() for the new arrclear() macro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants