Sorry, accidental gmail send... here's what I meant: On Sat, Apr 12, 2014 at 11:06 PM, Dirk Eddelbuettel <e...@debian.org> wrote: > What can work as a single expression in R sometimes needs to be disentangled > at the C++ level to help the compiler find its way through all the templates. > [snip] > > // [[Rcpp::export]] > NumericVector fromList(List outer, std::string name) { > List inner = outer[0]; // 0-based offsets in C++ > return inner["p"]; > }
I've noticed (I think...) having to do this sort of thing, but I want to ask a question to clarify: is it possible to have the above code work, but if you instead try: NumericVector fromList(List outer, std::string name) { return (outer[0])["p"]; } or even: NumericVector fromList(List outer, std::string name) { NumericVector vec = (outer[0])["p"]; return vec; } It will fail to compile? That's what you mean by needing to "help the compiler"? If so, is there some terminology for these sorts of problems? Krzysztof _______________________________________________ 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