checkXPtr: Check an 'XPtr"s Signature

View source: R/check.R

checkXPtrR 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 XPtr compiled with cppXPtr.

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

cppXPtr

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


RcppXPtrUtils documentation built on May 25, 2022, 9:05 a.m.