[Rcpp-devel] Patch for using Rcpp with proper check of TR1/C++11 headers

Yan Zhou zhouyan at me.com
Sun Dec 2 15:13:52 CET 2012

Hi Dirk,

First, in the last email I forgot to actually attach the file. Second, that one seems grown too large and is posted yet.

The attached Rcpp.diff is the change we discussed yesterday. RcppCommon.h is the new version of the header, which shall be easier to read than the diff file, which is a little mess.

To summary the change.

1. No longer define HAS_CXX0X. Currently this is only used for test of static_assert. If we are going to use more C++0X feature in future, this macro will be a source of pain (as I once experienced), due to the various status of C++11 implementations. Instead, now we have a separate macro HAS_STATIC_ASSERT

2. Most compiler dependent test macros are now grouped together
    i) Test C++0x language features: variadic template and static assert
    ii) Test C++0x library features: initializer_list, unordered_map, unordered_set
    iii) Test TR1 headers, unordered_map, unordered_set
The first two only define macros in the case that the compiler is indeed used in C++11 mode. There are situations that the compiler can include C++11 header but cannot compile them

3. Rcpp/sugar.h no longer need to include Rcpp/sugar/sets.h

4. Rcpp/inst/unitTests/runit.wrap.R: Change std::tr1::unordered_map to RCPP_UNORDERED_MAP

5. It passes some unit tests. It seems that these changes do not break unit tests. But there are tests that says in sourceCpp(...) a character vector is expected. I am not sure if it is caused by these changes. I am using a SVN tip version of R. And this does look like an R error. So perhaps nothing need to worry.

I would suggest you may do some more test and review before considering merge into the trunk (I was never known to be a careful person, typos are always possible). These changes perhaps only benefits very few people like me who are eager to use C++11, so there is no reason to merge them any time soon unless we are sure they don't introduce new problems. I have tested the build and installation under the compilers and platform I mentioned yesterday.


Yan Zhou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121202/65a3feb6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RcppCommon.h
Type: text/x-chdr
Size: 13073 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121202/65a3feb6/attachment-0001.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Rcpp.diff
Type: text/x-diff
Size: 10992 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121202/65a3feb6/attachment-0001.diff>

More information about the Rcpp-devel mailing list