Skip to content

Commit c76a5c3

Browse files
authored
Merge pull request #650 from RcppCore/feature/faq-on-c++11-etc
new Rcpp FAQ entry on C++1{1,4,7}
2 parents 8bf15c0 + db91222 commit c76a5c3

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2017-02-25 Dirk Eddelbuettel <[email protected]>
2+
3+
* vignettes/Rcpp-FAQ.Rnw: New subsection on C++11, C++14, C++17
4+
15
2017-02-17 Dirk Eddelbuettel <[email protected]>
26

37
* R/tools.R: More #nocov

vignettes/Rcpp-FAQ.Rnw

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,38 @@ Note: In \code{cpp}, the default \code{bool} values are \code{true} and
12391239
\code{false} whereas in R the valid types are \code{TRUE} or \code{FALSE}.
12401240

12411241

1242+
\subsection{Can I use C++11, C++14, C++17, ... with \pkg{Rcpp}?}
1243+
1244+
But of course. In a nutshell, this boils down to \emph{what your compiler
1245+
supports}, and also \emph{what R supports}. We expanded a little on this in
1246+
\href{http://gallery.rcpp.org/articles/rcpp-and-c++11-c++14-c++17/}{Rcpp Gallery
1247+
article} providing more detail. What follows in an abridged summary.
1248+
1249+
You can always \emph{locally} set appropriate \code{PKG\_CXXFLAGS} as an
1250+
environment variable, or via \code{~/.R/Makevars}. You can also plugins and/or R
1251+
support from \code{src/Makevars}:
1252+
1253+
\begin{itemize}
1254+
1255+
\item[\emph{C++11}] has been supported since early 2013 via a plugin selecting
1256+
the language standard which is useful for \code{sourceCpp()} etc. For
1257+
packages, R has supported it since R 3.1.0 which added the option to select
1258+
the language standard via \code{CXX\_STD = CXX11}. As of early 2017, over 120
1259+
packages on CRAN use this.
1260+
1261+
\item[\emph{C++14}] has been supported since early 2016 via a plugin selecting
1262+
the language standard which is useful for \code{sourceCpp()} etc. For
1263+
packages, R supports it since R 3.4.0 adding the option to select the language
1264+
standard via \code{CXX\_STD = CXX14}.
1265+
1266+
\item[\emph{C++17}] is itself more experimental now, but if you have a compiler
1267+
supporting (at least parts of) it, you can use it via plugin (starting with
1268+
Rcpp 0.12.10) for use via \code{sourceCpp()}, or via \code{PKG\_CXXFLAGS} or
1269+
other means to set compiler options. R support may be available at a later
1270+
date.
1271+
1272+
\end{itemize}
1273+
12421274

12431275
\section{Support}
12441276

0 commit comments

Comments
 (0)