[Rcpp-devel] variadic templates

Dirk Eddelbuettel edd at debian.org
Tue Jan 5 14:22:02 CET 2010


On 5 January 2010 at 13:49, Romain François wrote:
| There is no more CXX0X in the code. There is this instead:
| 
| #ifdef __GNUC__
| 	#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + 
| __GNUC_PATCHLEVEL__)
| 	#if GCC_VERSION >= 40300
| 		#define HAS_VARIADIC_TEMPLATES
| 	#endif
| 	#if GCC_VERSION >= 40400
| 		#define HAS_INIT_LISTS
| 	#endif
| #endif

Nice and easy. Good one. 

| The Makevars is the only thing left to change. You seem to know how to 
| do it.

We can do (and probably should as it is probably not the last time we need
something like this) this via configure, but we could even do a simple Perl
four-liner that reads the output of 'g++ --version' and blanks out -std=c++0x
accordingly.   The configure logic won't be much different but will bring
much bigger canons along for the same sparrows :)
 
| > | I've also added Rcpp::capabilities to query the capabilities of the
| > | package.
| > |
| > | For example on my system I have :
| > |
| > | $ Rscript -e "Rcpp:::capabilities()"
| > | variadic templates  initializer lists
| > |                TRUE               TRUE
| >
| > Nice one!

I saw that that gets resolved each and every time via a call to a compiled
function.  That's overkill too as this is a compile-time constant so we could
'write' the response from configure too.  Just a thought.

Idem for Rcpp:::CxxFlags() which we could fix.  Don't want to go overboard on
configure but what is known at compile time may as well get pinned down.

Dirk

-- 
Three out of two people have difficulties with fractions.


More information about the Rcpp-devel mailing list