r - Function param default value std:vector initialization with Rcpp and C++11? -


I am trying to write a C + + / RCPP function in which there is an optional argument that with length 1 The value of 0 is required to be a vector. The following is not compiled properly:

  cppFunction ("std :: vector  test (std :: vector & lt; int & gt; out = {0} } {Return;} ")   

I get the following error:

Error in the cpp function (" std :: vector test (std :: vector) Out = {1}} {\ NBack; \ n} "): No function definitions were found besides: Warning message: 1: Filey5f629605d7.cpp No function found for RQP :: export attribute: 2 2 : SourceCpp (in code = code, <= P>

What is the correct way to do this? / div>

currently Rcpp The package did not support the default value export. Ckages to repair (including Rcpp11 ), I have a solution on Rcpp : < / P>

  Library ("RQP") cppFunction (Plugins = C ("CPP 11"), 'Numeric Vector Test (Study :: Vector & Lt; Int & gt; Out) {return wrap (outside); } RCPP_MODULE (mod) {function ("test", & amp; test, list :: create (_ ["out"] = std :: vector  ({0}), "simple description" );} ', Verbose = True, rebilled = True)   

I change the type of return, thought that if you type std :: vector & lt; Int & gt; .

So, how it works: it just creates a document entry with the default value, the third argument for RCPP_MODULES .

crashes just 0} my r , therefore, I must explicitly put std :: vector is.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -