Hello,

I'm trying to build a function that calculates (for example) the log
of all elements of a container. I want this container to be a vector,
a Rcpp::numericVector , or perhaps a arama::colvec , so I'm trying
with templates ,and it compiles without the // [[Rcpp::export]] part,
but when I put it to export to R it doesn't work:

//declaration
template<class T>
T Vlog(T vectorForm);

//code
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export]]
template<class T>
T Vlog(T vectorForm)
{


   std::transform(vectorForm.begin(), vectorForm.end(),
vectorForm.begin(), log);
   return vectorForm;
}


gives 'T' was not declared in this scope.

if possible, How could I fix it?

Thank you in advance
Daniel,
_______________________________________________
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