This is more of a C++ question than an Rcpp question