This code worked in 2015 but doesn't now. It reports that there is no matching function for call to transform. Is there some issue with finding the std code now?
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector vecpow(const NumericVector base, const NumericVector exp) {
NumericVector out(base.size());
std::transform(base.begin(), base.end(),
exp.begin(), out.begin(), ::pow);
return out;
}
/*** R
vecpow(c(0:3), c(4:1))
***/
I found a solution here that involves replacing ::pow with static_cast<double(*)(double, double)>(::pow) At least, it works with the code above.