[Rcpp-devel] generalizing make_list
Romain Francois
romain at r-enthusiasts.com
Thu Mar 18 12:22:15 CET 2010
Hello,
I am very happy about the make_list templates, but it only handles
lists, and the next best thing would be having something that would
handle all sorts of vectors.
With some imagination, I think we can achieve this, but I was wondering
what the interface should be like. I was thinking maybe making it static
member function templates of Vector<>, so that we would do for example:
NumericVector x = NumericVector::create(
_["x"] = 2.0,
_["y"] = 1.0
) ;
I am more interested about a discussion about what should it be instead
of create than the usual conversation about _. There will be an
alternative to _, although it might involve more syntax, e.g.
NumericVector x = NumericVector::create(
named<REALSXP>("x") = 2.0,
named<REALSXP>("y") = 1.0
) ;
or :
NumericVector x = NumericVector::create(
NumericVector::named("x") = 2.0,
NumericVector::named("y") = 1.0
) ;
etc ...
Ideas ?
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/OIXN : raster images and RImageJ
|- http://tr.im/OcQe : Rcpp 0.7.7
`- http://tr.im/O1wO : highlight 0.1-5
More information about the Rcpp-devel
mailing list