Chapter 5 C++11

C++ 11 is a standard of C++ newly established in 2011, it introduces new functionalities and notations. Compared with the previous standard, many new features have been added to make C++ even easier for beginners. This document will actively exploit these features of C++11.

Important: The code examples in this document are written with C++11 enabled.

5.1 Enabling C++11

To enable C++11, add the following description somewhere in your Rcpp code, this is sufficient when you compile your rcpp code with Rcpp::sourceCpp().

// [[Rcpp::plugins("cpp11")]]

If you want to enable C++11 in your package, add code below in the DESCRIPTION file of your package.

SystemRequirements: C++11