-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Avoid copies in String #1219
Avoid copies in String #1219
Conversation
Add move constructor/assignment for String&& and std::string&&, and attempt to preserve the buffer/SEXP representation when copying in the existing copy ctor and assignment operators. Closes RcppCore#1218.
Looks very promising! |
@@ -1,4 +1,4 @@ | |||
2018-10-25 Dean Scarff <dos@scarff.id.au> | |||
2022-05-23 Dean Scarff <dos@scarff.id.au> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah! 😉
Reverse-dependency checks are running, slowly, on an older machine. No compilation or issues so far (besides "mechanical" stuff a few 'new-since-last-check' packages need additional build depends involved, and one graphics-device package needs a rebuild for R 4.2.0) so the PR is looking good from that angle. |
Looks good on first (very quick) pass. I can go over it more carefully in a few days if needed. |
One thing for reviewers to pay attention to: the new unit tests need C++11 and I didn't add guards in there. I'm a bit confused about what the expected C++98 support is in Rcpp now: eddelbuettel@ said Rcpp has "C++11 as a baseline" in #1218, but Contributing.md says C++11 code needs guards. The |
If no language level is specified R uses its default which for R 4.2.0 (and 4.1.0 onwards actually) is C++14, R 4.0.0 brought us eleven:
So we should be good but your point is well taken: these tests could fail for someone running them under R 3.6.3, say. I am not sure if we need (or want) to worry about that. |
That said, we have battled C++(11) availability for so long that we do of course have tools: > Rcpp:::capabilities()
variadic templates initializer lists exception handling tr1 unordered maps
FALSE TRUE TRUE TRUE
tr1 unordered sets Rcpp modules demangling classic api
TRUE TRUE TRUE FALSE
long long C++0x unordered maps C++0x unordered sets Full C++11 support
TRUE TRUE TRUE TRUE
new date(time) vectors
TRUE
> Rcpp:::capabilities()[["Full C++11 support"]]
[1] TRUE
> So maybe it would be best to wrap that test around this, or call PS I knew there was one more. I can't remember why we never wrapped this from R but there is > .Call(Rcpp:::rcpp_can_use_cxx11)
[1] TRUE
> which at least is a bit shorter. |
Ok, the reverse depends ran and have no issues whatsoever (commit of summary is here as usual). And I just added a baby commit to this PR to wrap an So I think we're good here. Comments, if any? I may wait a day as there is no rush and then merge this tomorrow. |
No further issues so happily merging what looks like a pretty nice PR -- thanks again! |
Add move constructor/assignment for String&& and std::string&&, and
attempt to preserve the buffer/SEXP representation when copying in the
existing copy ctor and assignment operators.
Closes #1218.
Checklist
R CMD check
still passes all tests