Skip to content

Commit 4067a44

Browse files
committed
feat: New END_CPP11_EX() macro that allows parameterizing the return value
1 parent aeb1895 commit 4067a44

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

inst/include/cpp11/declarations.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ T& unmove(T&& t) {
4141
SEXP err = R_NilValue; \
4242
char buf[CPP11_ERROR_BUFSIZE] = ""; \
4343
try {
44-
#define END_CPP11 \
44+
#define END_CPP11_EX(RET) \
4545
} \
4646
catch (cpp11::unwind_exception & e) { \
4747
err = e.token; \
@@ -57,4 +57,5 @@ T& unmove(T&& t) {
5757
} else if (err != R_NilValue) { \
5858
R_ContinueUnwind(err); \
5959
} \
60-
return R_NilValue;
60+
return RET;
61+
#define END_CPP11 END_CPP11_EX(R_NilValue)

0 commit comments

Comments
 (0)