MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / release

Method release

inst/include/Rcpp/XPtr.h:183–193  ·  view source on GitHub ↗

* Release the external pointer (if any) immediately. This will cause * the pointer to be deleted and it's storage to be set to NULL. * After this call the get() method returns NULL and the checked_get() * method throws an exception. * * See the discussion here for the basic logic behind release: * https://stat.ethz.ch/pipermail/r-help/2007-August/137871.html */

Source from the content-addressed store, hash-verified

181 * https://stat.ethz.ch/pipermail/r-help/2007-August/137871.html
182 */
183 void release() {
184
185 if (get() != NULL) {
186 // Call the finalizer -- note that this implies that finalizers
187 // need to be ready for a NULL external pointer value (our
188 // default C++ finalizer is since delete NULL is a no-op).
189 // This clears the external pointer just before calling the finalizer,
190 // to avoid interesting behavior with co-dependent finalizers.
191 finalizer_wrapper<T,Finalizer>(Storage::get__());
192 }
193 }
194
195 inline operator T*() {
196 return checked_get();

Callers 2

xptr_releaseFunction · 0.80
xptr_access_releasedFunction · 0.80

Calls 1

getFunction · 0.85

Tested by

no test coverage detected