The real issue is that Rcpp::as requires that you specify the type you want to convert to manually, such as Rcpp::as<std::string>.

The input of all as overloads is always a SEXP so the compiler does not know which one to use and cannot make the decision automatically. that's why you need to help it. Things work differently for wrap which can use the input type to decide which overload it will use.