Skip to content

Commit a8bbece

Browse files
committed
Merge pull request #417 from krlmlr/patch-1
const support for Nullable<>
2 parents 73c59b7 + 2c57b98 commit a8bbece

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

inst/NEWS.Rd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
\newcommand{\ghpr}{\href{https://github.com/RcppCore/Rcpp/pull/#1}{##1}}
44
\newcommand{\ghit}{\href{https://github.com/RcppCore/Rcpp/issues/#1}{##1}}
55

6+
\section{Changes in Rcpp version 0.12.4 (2016-01-XX)}{
7+
\itemize{
8+
\item Changes in Rcpp API:
9+
\itemize{
10+
\item \code{Nullable<>::operator SEXP()} and
11+
\code{Nullable<>::get()} now also work for \code{const} objects
12+
(PR \ghpr{417}).
13+
}
14+
}
15+
}
16+
617
\section{Changes in Rcpp version 0.12.3 (2016-01-10)}{
718
\itemize{
819
\item Changes in Rcpp API:

inst/include/Rcpp/Nullable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ namespace Rcpp {
7676
*
7777
* @throw 'not initialized' if object has not been set
7878
*/
79-
inline operator SEXP() {
79+
inline operator SEXP() const {
8080
checkIfSet();
8181
return m_sexp;
8282
}
@@ -86,7 +86,7 @@ namespace Rcpp {
8686
*
8787
* @throw 'not initialized' if object has not been set
8888
*/
89-
inline SEXP get() {
89+
inline SEXP get() const {
9090
checkIfSet();
9191
return m_sexp;
9292
}

inst/unitTests/cpp/misc.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,22 +179,22 @@ void test_stop_variadic() {
179179
}
180180

181181
// [[Rcpp::export]]
182-
bool testNullableForNull(Nullable<NumericMatrix> M) {
182+
bool testNullableForNull(const Nullable<NumericMatrix>& M) {
183183
return M.isNull();
184184
}
185185

186186
// [[Rcpp::export]]
187-
bool testNullableForNotNull(Nullable<NumericMatrix> M) {
187+
bool testNullableForNotNull(const Nullable<NumericMatrix>& M) {
188188
return M.isNotNull();
189189
}
190190

191191
// [[Rcpp::export]]
192-
SEXP testNullableOperator(Nullable<NumericMatrix> M) {
192+
SEXP testNullableOperator(const Nullable<NumericMatrix>& M) {
193193
return M;
194194
}
195195

196196
// [[Rcpp::export]]
197-
SEXP testNullableGet(Nullable<NumericMatrix> M) {
197+
SEXP testNullableGet(const Nullable<NumericMatrix>& M) {
198198
return M.get();
199199
}
200200

0 commit comments

Comments
 (0)