1\name{evalCpp} 2\alias{evalCpp} 3\alias{areMacrosDefined} 4\title{ 5Evaluate a C++ Expression 6} 7\description{ 8Evaluates a C++ expression. This creates a C++ function using 9\code{\link{cppFunction}} and calls it to get the result. 10} 11\usage{ 12evalCpp(code, depends = character(), plugins = character(), includes = character(), 13 rebuild = FALSE, cacheDir = getOption("rcpp.cache.dir", tempdir()), 14 showOutput = verbose, verbose = getOption("verbose")) 15 16areMacrosDefined(names, depends = character(), includes = character(), 17 rebuild = FALSE, showOutput = verbose, 18 verbose = getOption("verbose")) 19} 20\arguments{ 21 \item{code}{ 22C++ expression to evaluate 23} 24 \item{names}{ 25names of the macros we want to test 26} 27 \item{plugins}{ 28see \code{\link{cppFunction}} 29} 30 \item{depends}{ 31see \code{\link{cppFunction}} 32} 33 \item{includes}{ 34see \code{\link{cppFunction}} 35} 36 \item{rebuild}{ 37see \code{\link{cppFunction}} 38} 39 \item{cacheDir}{ 40 Directory to use for caching shared libraries. If the underlying code passed to \code{sourceCpp} has not changed since the last invocation then a cached version of the shared library is used. The default value of \code{tempdir()} results in the cache being valid only for the current R session. Pass an alternate directory to preserve the cache across R sessions. 41} 42 \item{showOutput}{ 43see \code{\link{cppFunction}} 44} 45 \item{verbose}{ 46see \code{\link{cppFunction}} 47} 48} 49\note{ 50 The result type of the C++ expression must be compatible with \code{Rcpp::wrap}. 51} 52\value{ 53 The result of the evaluated C++ expression. 54} 55\seealso{ 56\code{\link{sourceCpp}}, \code{\link{cppFunction}} 57} 58\examples{ 59\dontrun{ 60 61evalCpp( "__cplusplus" ) 62evalCpp( "std::numeric_limits<double>::max()" ) 63 64areMacrosDefined( c("__cplusplus", "HAS_TR1" ) ) 65 66} 67} 68