I am using LAPACK library to create a R-package using C++. I am using unique_ptr for defining the arrays as
unique_ptr<double[]> my_arr(new double[arr_length]);
I then pass this unique_ptr to library function (FORTRAN function) which accepts pointer to double array and will update this array inside the function as
F77_CALL(daxpy) (&num_feat_, &beta, tmp, &inc_one, my_arr.get(), &inc_one);
After going through web, I noticed it is not recommended to pass unique_ptr as pointer argument to a function. However, the library functions I am using needs a pointer in their argument. I can not release the pointer before sending it to the function since the library function needs to update the pointer. Is there any efficient way to handle this?