Hello all,
I need to convert a std::string to a RAWSXP. I think i know hot do to this
without Rcpp. It goes something like this (i haven't tested this):

SEXP stringToRaw(std::string x) {
  SEXP y;
  PROTECT(y = allocVector(RAWSXP, x.length()));
  memcpy(RAW(y), x.data(), x.length());
  UNPROTECT(1);
  return y;
}

How do i do this with Rcpp? Say i want to return a Rcpp::RawVector?
Thanks,
Koert

_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to