checkXPtr {RcppXPtrUtils} | R Documentation |
Check an XPtr
's Signature
Description
Check 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.
Usage
checkXPtr(ptr, type, args = character(), call. = TRUE)
Arguments
ptr |
an object of class |
type |
the return type. |
args |
a list of argument types. |
call. |
logical, indicating if the call should become part of the error message. |
See Also
Examples
# 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
[Package RcppXPtrUtils version 0.1.2 Index]