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

Use a universal reserve() method #373

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

DavisVaughan
Copy link
Member

Closes #368 - this issue doesn't matter too much, but if you start as a writable ALTREP object and then call push_back() and that resizes the vector, then it will still look like an ALTREP object even though Rf_xlengthgets() will never produce an ALTREP object. The right thing to do is to always recompute the flag from the newly allocated object.

When working on this, I realized we could unify the reserve() methods, removing a lot of duplication, which is great. It now also sets the data_p_ for VECSXP and STRSXP which was not happening before, but get_p() will always return nullptr for these types, so no harm done.

@DavisVaughan DavisVaughan merged commit 457c441 into r-lib:main Aug 8, 2024
14 checks passed
@DavisVaughan DavisVaughan deleted the fix/reserve-unification branch August 8, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reserve() methods should update is_altrep_
1 participant