Itâs easy to create active bindings in R via makeActiveBinding()
. This package faciliates the creation of active bindings that link back to C++ code. It provides an interface that allows binding several identifiers in an environment to the same C++ function, which is then called with the name (and a payload) as argument.
It is recommended to use the newer _wrapped
functions that support passing an arbitrary Rcpp::List
as payload. This allows to store an Rcpp::XPtr
to a C++ object in that list. The XPtr
then will be released when the payload is garbage-collected, and the C++ object will be destroyed.
You can install bindrcpp from github with:
ExampleThe following C++ module exports a function test_tolower_bindings()
that creates active bindings that return the binding name in lowercase.
This function can be called from R:
The bindings are read-only:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4