(This article was first published on R Enthusiast and R/C++ hero, and kindly contributed to R-bloggers)
Following up on this post, I have just commited some code that makes the using namespace Rcpp11 ;
automatic, I was just tired of typing it. So now, you can just do :
#include
If however, for some weird reason (some people love littering their code with Rcpp::
) you don’t want the using namespace Rcpp11;
to be automatically added, you can either switch to :
#include
or define the RCPP11_DISABLE_AUTOMATIC_USING_NAMESPACE
macro before you include
:
#define RCPP11_DISABLE_AUTOMATIC_USING_NAMESPACE
#include
I know that’s a lot of typing, but the idea is to make the most useful pattern (you almost always want to have using namespace Rcpp11 ;
) easier than the less useful.
Unsurprisingly, the
header looks like this:
#ifndef RCPP11_includes
#define RCPP11_includes
#include
#ifndef RCPP11_DISABLE_AUTOMATIC_USING_NAMESPACE
using namespace Rcpp11 ;
#endif
#endif
To leave a comment for the author, please follow the link and comment on their blog: R Enthusiast and R/C++ hero.
R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...