Skip to content

Making things a little bit faster #458

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
rollback strings
  • Loading branch information
pachadotdev committed May 9, 2025
commit e0229d54faccbffe557581fc0d234251fb6998a9
11 changes: 6 additions & 5 deletions inst/include/cpp11/strings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ typedef r_vector<r_string> strings;
// 2nd, 3rd, ..., Nth name: reserve exactly one more, then emplace
template <typename T>
inline void r_vector<T>::push_back(const named_arg& value) {
push_back(value.value());
if (Rf_xlength(names()) == 0) {
cpp11::writable::strings new_nms(size());
names() = new_nms;
}
cpp11::writable::strings nms(names());

nms.reserve(nms.size() + 1);
nms.push_back(value.name());

names() = nms;
nms[size() - 1] = value.name();
}
} // namespace writable

Expand Down