[Rcpp-devel] max length of Rcpp::List is 20 elements?

Florian Oswald florian.oswald at gmail.com
Mon Oct 21 11:59:33 CEST 2013


Dear all,

I've noted that I cannot return an Rcpp::List longer than 20 elements. In
particular, this here compiles:

library(Rcpp)
library(inline)

src <- '
List out = List::create(_["x1"] = 1,
_["x2"] = 2,
_["x3"] = 3,
 _["x4"] = 4,
_["x5"] = 5,
_["x6"] = 6,
 _["x7"] = 7,
_["x8"] = 8,
_["x9"] = 9,
 _["x10"] = 10,
_["x11"] = 11,
_["x12"] = 12,
 _["x13"] = 13,
_["x14"] = 14,
_["x15"] = 15,
 _["x16"] = 16,
_["x17"] = 17,
_["x18"] = 18,
 _["x19"] = 19,
// _["x20"] = 20,
 _["x21"] = 21);

return out;'

f <- cxxfunction(body=src,plugin='Rcpp')
f()

whereas it does not if you uncomment element "x20" with the error message

no matching function for call to
‘Rcpp::Vector<19>::create(Rcpp::traits::named_object<int>, ...

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?

Best,
Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20131021/f42db0e9/attachment.html>


More information about the Rcpp-devel mailing list