[Rd] R 3.1.0 and C++11
Dirk Eddelbuettel
edd at debian.org
Thu Apr 10 18:26:11 CEST 2014
On 10 April 2014 at 15:58, Martyn Plummer wrote:
| The R configure script is permissive and will enable "C++11" support if
| your compiler accepts -std=c++0x. Obviously you will only get partial
| support for the C++11 standard (But this is also true of some compilers
| that accept -std=c++11). You may be OK if you just want C99 features,
| which were missing from the C++98 standard, and features previously
| introduced in the TR1 extension. But there are no guarantees.
Indeed. I am using that feature (of asking for C++11 and being guaranteed a
set of changes relative to C99) in the RcppCNPy upload that went onto CRAN
this morning --- as we now have consistent 'long long' support. Which also
works with Rtools and g++ 4.6.*.
| Cross-platform support for C++11 is going to remain poor for some time
| to come, I'm afraid.
Precisely.
One does have the option of using what R / CRAN now "C++11" incrementally by
taking what is provided where it is provided.
My simple example finally getting 'long long' via the cstdint header works
that way (on my machine, cstdint goes back to the oldest compiler I still
have, g++-4.4). But it needs one of the extensions: -std=c++11 where
available, -std=c++0x on older systems.
And eg Martin Morgan's recent question of how to use 'unordered_map' should
work the same way: just turn on C++11 and depend on R 3.1.0. That header is
also provided at least as far back as 4.4.
Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the R-devel
mailing list