[Rcpp-devel] Idiom for accessing scalars

Hadley Wickham hadley at rice.edu
Wed Jan 4 14:42:51 CET 2012


> We have "as" for this, and wrap for the other way around:
>
> f<- cxxfunction(signature(x = "integer"), plugin = "Rcpp", '
>  int x2 = as<int>(x) ;
>
>  return wrap(x2) ;
> ')

Got it - thanks!

And is there a standard for what you call the C++ equivalent of the R
arguments?  i.e. x_ = as<int>(x) ?

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/


More information about the Rcpp-devel mailing list