On 2011-09-02, at 5:19 AM, Dirk Eddelbuettel wrote: > Maybe this would do > > double *p=third_party_function(nn); > NumericVector ret(nn); // new memory > copy(ret.begin(), ret.end(), p); // untested > delete p; > return ret; > > | where third_party_function() is C legacy code that is documented as > | returning a block of memory of size nn that the client should take > | ownership of.
If third_party_function is really C legacy code, wouldn't the block of code be more likely to have been allocated with a 'malloc', and so you should release it with a 'free'? http://stackoverflow.com/questions/2570223/malloc-and-delete-in-c-opinions Davor _______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
