3 #include <torch/csrc/utils/python_stub.h> 13 T *
get() {
return ptr; }
14 const T *
get()
const {
return ptr; }
15 T * release() {
T *tmp = ptr; ptr =
nullptr;
return tmp; }
16 operator T*() {
return ptr; }
17 THPPointer& operator =(
T *new_ptr) noexcept { free(); ptr = new_ptr;
return *
this; }
18 THPPointer& operator =(
THPPointer &&p) noexcept { free(); ptr = p.ptr; p.ptr =
nullptr;
return *
this; }
19 T * operator ->() {
return ptr; }
20 explicit operator bool()
const {
return ptr !=
nullptr; }