# Keep calm and #include <Rcpp11>

June 19, 2014
By

(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 <Rcpp11>


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 <Rcpp.h>


or define the RCPP11_DISABLE_AUTOMATIC_USING_NAMESPACE macro before you include <Rcpp11>:

#define RCPP11_DISABLE_AUTOMATIC_USING_NAMESPACE
#include <Rcpp11>


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 <Rcpp11> header looks like this:

#ifndef RCPP11_includes
#define RCPP11_includes

#include <Rcpp.h>

#ifndef RCPP11_DISABLE_AUTOMATIC_USING_NAMESPACE
using namespace Rcpp11 ;
#endif

#endif