[Rcpp-devel] feature proposal: ListOf

Romain Francois romain at r-enthusiasts.com
Mon Oct 21 14:32:57 CEST 2013


Hello,

Another thing I have developped in dplyr but might be generally useful 
is the ListOf class. See 
https://github.com/hadley/dplyr/blob/master/inst/include/tools/ListOf.h

The idea is to embed, by means of the template parameter what this list 
contains. Of course it is only usable if the list contains only objects 
that are compatible with the type.

So if we knew we had a list of numeric vector, we could use :

ListOf<NumericVector>, or ListOf< std::vector<double> >

so that when we use LisOf extracting operator, we know what we get. This 
is something I've shared a few times on mailing list and SO, but could 
be generally useufl for Rcpp users.

Do people want to see this in Rcpp.

This is orthogonal to everything else, so the risk is minimum. This is a 
template class, so the cost is null if the class is not used.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30



More information about the Rcpp-devel mailing list