From edd at debian.org  Thu Apr 10 18:26:11 2014
From: edd at debian.org (Dirk Eddelbuettel)
Date: Thu, 10 Apr 2014 11:26:11 -0500
Subject: [Rd] R 3.1.0 and C++11
In-Reply-To: <1397145527.11062.8.camel@braque.iarc.fr>
References: <21073.63553.888272.510490@max.nulle.part>
	<31E214B6DF75104E942856C2F74953CB0505C0F9@exchange>
	<21075.11278.577153.103691@max.nulle.part>
	<CAMi=pg5aRiFG7s+f4bERE6QQe+D7dH1Y_b9Q6AsH3A7Gz0M-qw@mail.gmail.com>
	<478ce69b232b57db8fa74fa93e5a646a@r-enthusiasts.com>
	<CAP01uRnkS7YM3i5sJOAhfF3V4t-ZsMuXGFB2ViFQc_FTYwhegw@mail.gmail.com>
	<1397145527.11062.8.camel@braque.iarc.fr>
Message-ID: <21318.50723.582070.694792@max.nulle.part>


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



[Rd] R 3.1.0 and C++11
Dirk Eddelbuettel