On 10 February 2012 at 15:05, Douglas Bates wrote:
| Or if you want to show off you could collapse it to
| 
| > src <- "
| +   NumericMatrix tmpMatrix(as<SEXP>(List(L)[0]));
| +   return wrap(tmpMatrix.ncol());
| + "
| > f <- cxxfunction(signature(L="list"), src, plugin = "Rcpp" )
| > f(list(matrix(1:9,3,3)))
| [1] 3

Nice. The as<> cast is a good idea, it may even work with as<NumericMatrix>
which would avoid the ugly SEXP in user code ...

Dirk

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to