cpp11::raws to_raw(const std::string input) {
cpp11::writable::raws rv(input.size());
for(unsigned long i=0; i<input.size(); i++) {
rv[i] = input.c_str()[i];
}
return rv;
}
I ended up using Rcpp instead and switched to a faster algo
// append std::string at the end of a std::vector<uint8_t> vector
void to_raw(const std::string input, std::vector<uint8_t>* output) {
output->insert(output->end(), input.begin(), input.end());
}