This is not directly an Rcpp question but it does relate to
programming style when using Rcpp.

I try to avoid statements like

using namespace Rcpp;

in a header file because that will change the visible names in any
other files that include this header.  The alternative, of course, is
many declarations with long names like


 Rcpp::NumericVector   foo(const Rcpp::IntegerVector&);

Lately I have taken to including statements of the form

namespace mynamespace {
    using Rcpp::NumericVector;
    using Rcpp::IntegerVector;

    NumericVector foo(const IntegerVector&);
}

so that I control exactly which names are exposed without qualifiers
and not expose the entire Rcpp namespace.

Can anyone tell me if that using declaration has effect only within
the declared namespace "mynamespace"?  That is what I want to have
happen so that by the end of the header file my temporary exposure of
names is no longer in effect.
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to