-
-
Notifications
You must be signed in to change notification settings - Fork 219
const support for Nullable<> #417
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,22 +179,22 @@ void test_stop_variadic() { | |
} | ||
|
||
// [[Rcpp::export]] | ||
bool testNullableForNull(Nullable<NumericMatrix> M) { | ||
bool testNullableForNull(const Nullable<NumericMatrix>& M) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Methinks we may want these as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's no big deal to re-add the pre-PR versions, but I wonder under what circumstances code can succeed for |
||
return M.isNull(); | ||
} | ||
|
||
// [[Rcpp::export]] | ||
bool testNullableForNotNull(Nullable<NumericMatrix> M) { | ||
bool testNullableForNotNull(const Nullable<NumericMatrix>& M) { | ||
return M.isNotNull(); | ||
} | ||
|
||
// [[Rcpp::export]] | ||
SEXP testNullableOperator(Nullable<NumericMatrix> M) { | ||
SEXP testNullableOperator(const Nullable<NumericMatrix>& M) { | ||
return M; | ||
} | ||
|
||
// [[Rcpp::export]] | ||
SEXP testNullableGet(Nullable<NumericMatrix> M) { | ||
SEXP testNullableGet(const Nullable<NumericMatrix>& M) { | ||
return M.get(); | ||
} | ||
|
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.
Why did you remove
checkIfSet()
?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.
Now forwarded to get().
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.
I can see that. Let me rephrase: Why did you make that change? What is the reasoning?
I see no relation in that and the
const
change. So why mess with it?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.
You're right, it's an unrelated change. I included it, because it affects code in close proximity to the code that I was touching anyway. The reason for that change: in the unlikely event that the implementation of get() changes, you will also want to change the implementation of operator SEXP(), because they seem synonymous.
That said, I'm totally fine with excluding that particular change from this PR, if you prefer that.