Displaying 1 result from an estimated 1 matches for "std_iterator".
Did you mean:
add_iterator
2007 Aug 16
0
call R function in c++ program
...n destructor
Rf_endEmbeddedR(0);
// for translate std::vector to SEXP VECTOR
// std_vector are defined as "vector<double>" and iterator as
"vector<double>::iterator"
PROTECT( vector_SEXP = allocVector(REALSXP, std_vector.size()) );
int i = 0;
for(std_iterator s_it=std_vector.begin(); s_it!=std_vector.end();
s_it++)
{
REAL(vector_SEXP)[i] = (double) *s_it;
i++;
}
UNPROTECT(1);
// for create a variable in R environement
defineVar(install("variable_name"), variable_value_SEXP, rho);
// for execute "com...