Skip to content
Prev 6970 / 10988 Next

[Rcpp-devel] Problems wrapping stl::vector<int>

Hello, 

wrap is for converting an object of arbitrary class to an R object. It deduces what to do based on the class of what you pass it. So you usually don?t specify the template parameter. So you?d usually just write : 

return wrap(a); 

If you wanted to be explicit, then you would use: 

return wrap< std::vector<int> >( a ) ;

wrap returns a ? SEXP ? (any R object) which can be used by an IntegerVector constructor. So you can do: 

IntegerVector x( wrap(a) ) ;

or even:
 
IntegerVector  = as<IntegerVector>( wrap(a) ) ;

Romain

Le 3 janv. 2014 ? 17:18, Alessandro Mammana <mammana at molgen.mpg.de> a ?crit :