In cpp4r, you can use external_pointer. In
Rcpp, you can use XPtr to create external
pointers. These have significantly different syntax, and
cpp4r does not provide an attr method for
external pointers.
For example, the cpp11tesseract package defines:
You can then call TessPtr with:
As a result, the R equivalent that the OCR C++ function verifies that the engine is such that the following is true:
The equivalent tesseract package,
which uses Rcpp, defines:
typedef Rcpp::XPtr<tesseract::TessBaseAPI, Rcpp::PreserveStorage, tess_finalizer, true> TessPtr;
You can then call TessPtr with:
Similarly, the Rcpp version checks the engine with: