On 3 January 2014 at 11:42, Hadley Wickham wrote:
| Another solution is to rely on Rcpp's auto-wrapping smarts:
|
| // [[Rcpp::export]]
| std::vector<int> test(){
| std::vector<int> a;
| a.push_back(1);
| a.push_back(2);
| a.push_back(3);
| return a;
| }
Nope.
R> sourceCpp("/tmp/scratchpad.cpp")
scratchpad.cpp: In function ‘Rcpp::IntegerVector test()’:
scratchpad.cpp:12:12: error: could not convert ‘a’ from ‘std::vector<int>’ to
‘Rcpp::IntegerVector {aka Rcpp::Vector<13>}’
scratchpad.cpp:13:1: warning: control reaches end of non-void function
[-Wreturn-type]
make: *** [scratchpad.o] Error 1
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG
-I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe
-Wno-unused -pedantic -c scratchpad.cpp -o scratchpad.o
Error in sourceCpp("/tmp/scratchpad.cpp") :
Error 1 occurred building shared library.
R> system("tail -4 /tmp/scratchpad.cpp")
//return wrap(a);
return a;
}
R>
Dirk
--
Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel