I have a CharacterVector from which I try to extract an element and assign it 
to a std::string:

CharacterVector xs;
...
std::string x = as<std::string>(xs(0));

This throws exception: "expecting a string". Why? Looking with the debugger at 
"xs", this is what I see:

(gdb) print xs
$6 = (CharacterVector &) @0x7fff5fbfcca0: {
  <Rcpp::RObject> = {
    _vptr$RObject = 0x1061979d0, 
    m_sexp = 0x10582b618
  }, 
  <Rcpp::VectorBase<16,true,Rcpp::Vector<16> >> = {
    <Rcpp::traits::expands_to_logical__impl<16>> = {<No data fields>}, <No data 
fields>}, 
  <Rcpp::internal::eval_methods<16>> = {<No data fields>}, 
  members of Rcpp::Vector<16>: 
  cache = {
    p = 0x7fff5fbfcca0
  }
}

I've no idea how to poke any deeper and see what the actual R object in the 
first element of the vector is. Can anyone help with this?

This is with R 2.15.2 and Rcpp 0.10.2 on OS X 10.7.5. The code in question 
worked fine with Rcpp 0.10.0.

Davor
_______________________________________________
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