
XPtr
's SignatureCheck the signature (i.e., arguments and return type) of the output of
cppXPtr
, which is an external pointer wrapped in an object of
class XPtr
. If the user-supplied C++ function does not match the
signature, the wrapper throws an informative error.
checkXPtr(ptr, type, args = character(), call. = TRUE)
an object of class XPtr
compiled with cppXPtr
.
the return type.
a list of argument types.
logical, indicating if the call should become part of the error message.
# NOT RUN {
# takes time to compile
ptr <- cppXPtr("double foo(int a, double b) { return a + b; }")
checkXPtr(ptr, "double", c("int", "double")) # returns silently
try(checkXPtr(ptr, "int", c("double", "std::string"))) # throws error
# }
Run the code above in your browser using DataLab