<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I have a CharacterVector from which I try to extract an element and assign it to a std::string:<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><br></div><div>CharacterVector xs;</div><div>...</div><div>std::string x = as<std::string>(xs(0));</div></blockquote><div><br></div><div>This throws exception: "expecting a string". Why? Looking with the debugger at "xs", this is what I see:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div>(gdb) print xs</div></div><div><div>$6 = (CharacterVector &) @0x7fff5fbfcca0: {</div></div><div><div>  <Rcpp::RObject> = {</div></div><div><div>    _vptr$RObject = 0x1061979d0, </div></div><div><div>    m_sexp = 0x10582b618</div></div><div><div>  }, </div></div><div><div>  <Rcpp::VectorBase<16,true,Rcpp::Vector<16> >> = {</div></div><div><div>    <Rcpp::traits::expands_to_logical__impl<16>> = {<No data fields>}, <No data fields>}, </div></div><div><div>  <Rcpp::internal::eval_methods<16>> = {<No data fields>}, </div></div><div><div>  members of Rcpp::Vector<16>: </div></div><div><div>  cache = {</div></div><div><div>    p = 0x7fff5fbfcca0</div></div><div><div>  }</div></div><div><div>}</div></div></blockquote><div><br></div><div>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?</div><div><br></div><div>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.</div><div><br></div><div>Davor</div></body></html>