[Rcpp-devel] variadic templates

Romain François francoisromain at free.fr
Tue Jan 5 14:39:59 CET 2010


On 01/05/2010 02:22 PM, Dirk Eddelbuettel wrote:
>
> 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 :)

Who needs perl when you have R:

$ g++ --version | r -e "x <- readLines(n=1); cat(sub( '^.*[)] (.*?) 
.*$', '\\\\1', x )) "
4.4.1

> |>  | 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.

Yes, but it's not called very often.

> 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
>


-- 
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