Is there a way to use an Rcpp function inside an R6 class while developing a package? Example: I have a add.cpp in the /src folder of my package as follows
#include <Rcpp.h>
using namespace Rcpp;
//
//' Add two numbers
//'
//' @param x An integer.
//' @param y An integer
// [[Rcpp::export]]
int add(int x, int y) {
return x + y;
}
I wish to use the Rcpp add function as a public function inside my R6 class called Numbers, which resides in the Numbers.R file in the /R folder of my package
Numbers <- R6class(
"Number",
private = list(
a =6,
b=10
),
public = list(
# How to use add function from add.cpp file using private$a and private$b as inputs
)
)