<html><body><div style="color:#000; background-color:#fff; font-family:lucida console, sans-serif;font-size:12pt"><div>[...]</div><div><br></div><div>> You were very, very close to this existing example from the unit test file</div><div>> runit.Vector.R (which, as Lists are GenericVector objects, also contains</div><div>> lists):</div><div>> </div><div>> ,"list_push_back"=list(</div><div>> signature(x = "list"),</div><div>> 'List list(x) ;</div><div>> list.push_back( 10 ) ;</div><div>> list.push_back( "bar", "foo" ) ;</div><div>> return list ;</div><div>>
')</div><div>> </div><div>> So with that it works if I write your example like this:</div><div>> </div><div>> -----------------------------------------------------------------------------</div><div>> library(inline)</div><div>> </div><div>> code <- '</div><div>> Rcpp::List myList(rList);</div><div>> myList.push_back(10);</div><div>> myList.push_back("foo", "bar");</div><div>> return myList;</div><div>> '</div><div>> </div><div>> lfun <- cxxfunction(signature(rList = "list"),</div><div>> body = code,</div><div>> plugin = "Rcpp")</div><div>>
-----------------------------------------------------------------------------</div><div>> </div><div>> as can be seen below.</div><div>> </div><div>> Do not underestimate the usefulness of 750+ regression tests in 330+</div><div>> functions that are run with every release. They do provide examples, even if</div><div>> they are a little hard to read at first :)</div><div>> </div><div>> Also, if an example does not compile, comment-out and simplify til it</div><div>> does. The templated code is finicky. I often split very complex expression</div><div>> into components as there is no shame in using temporary variables....</div><div><br></div><div>Great! Thanks, Dirk. I HAVE looked at the runit stuff before but didn't</div><div>think to do so in this case.</div><div><br></div><div>-- Mike</div><div style="font-size: 12pt; "><br></div></div></body></html>