[Rcpp-devel] variadic templates
Romain François
francoisromain at free.fr
Sat Jan 2 21:45:51 CET 2010
Hi,
they are really nice. they provide some sort of ellipsis in the template
argument.
unfortunately, they are not part of the current standard, but in the
forthcoming new standard c++0x. See
http://en.wikipedia.org/wiki/C%2B%2B0x#Variadic_templates
But, gcc has many of c++0x features covered.
http://gcc.gnu.org/projects/cxx0x.html
Why should we are about them. For example we want to mimic making this
call:
> call( "rnorm", 10L, 0.0, 2.0 )
rnorm(10L, 0, 2)
in C++, we (as soon as I can commit it) have the Language class, and I'd
like calling it something like :
Language obj( "rnorm", 10, 0.0, 2.0 ) ;
The wrap functions provide conversion of each element to a SEXP, and
variadic templates would take care of the rest.
This needs this in the Makevars :
PKG_CPPFLAGS += -I. -std=c++0x
and presumably also in RcppCxxFlags
This is available as of GCC 4.3, so I guess we could #ifdef this somehow ?
Ideas ?
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/IW9B : C++ exceptions at the R level
|- http://tr.im/IlMh : CPP package: exposing C++ objects
`- http://tr.im/HlX9 : new package : bibtex
More information about the Rcpp-devel
mailing list