<div dir="ltr">Dear all,<div><br></div><div>I've noted that I cannot return an Rcpp::List longer than 20 elements. In particular, this here compiles:</div><div><br></div><div><div>library(Rcpp)</div><div>library(inline)</div>
<div><br></div><div>src <- '</div><div>List out = List::create(_["x1"] = 1,</div><div><span class="" style="white-space:pre"> </span>_["x2"] = 2,</div><div><span class="" style="white-space:pre"> </span>_["x3"] = 3,</div>
<div><span class="" style="white-space:pre"> </span>_["x4"] = 4,</div><div><span class="" style="white-space:pre"> </span>_["x5"] = 5,</div><div><span class="" style="white-space:pre"> </span>_["x6"] = 6,</div>
<div><span class="" style="white-space:pre"> </span>_["x7"] = 7,</div><div><span class="" style="white-space:pre"> </span>_["x8"] = 8,</div><div><span class="" style="white-space:pre"> </span>_["x9"] = 9,</div>
<div><span class="" style="white-space:pre"> </span>_["x10"] = 10,</div><div><span class="" style="white-space:pre"> </span>_["x11"] = 11,</div><div><span class="" style="white-space:pre"> </span>_["x12"] = 12,</div>
<div><span class="" style="white-space:pre"> </span>_["x13"] = 13,</div><div><span class="" style="white-space:pre"> </span>_["x14"] = 14,</div><div><span class="" style="white-space:pre"> </span>_["x15"] = 15,</div>
<div><span class="" style="white-space:pre"> </span>_["x16"] = 16,</div><div><span class="" style="white-space:pre"> </span>_["x17"] = 17,</div><div><span class="" style="white-space:pre"> </span>_["x18"] = 18,</div>
<div><span class="" style="white-space:pre"> </span>_["x19"] = 19,</div><div><span class="" style="white-space:pre"> </span>//<span class="" style="white-space:pre"> </span>_["x20"] = 20,</div>
<div><span class="" style="white-space:pre"> </span>_["x21"] = 21);</div><div><br></div><div>return out;'</div><div><br></div><div>f <- cxxfunction(body=src,plugin='Rcpp')</div><div>f()</div>
</div><div><br></div><div>whereas it does not if you uncomment element "x20" with the error message </div><div><br></div><div>no matching function for call to ‘Rcpp::Vector<19>::create(Rcpp::traits::named_object<int>, ...<br>
</div><div><br></div><div>from which I deduce that the Rcpp::List is an Rcpp::Vector of length 20. Was there any strong reason to stop at 20 elements?</div><div><br></div><div>Best,</div><div>Florian</div></div>