23 template <
typename... Args>
26 raw =
new T(std::forward<Args>(args)...);
44 return std::exchange(raw,
nullptr);
52 std::shared_ptr<close_ptr<T>> internal;
60 template <
typename... Args>
67 return internal.get()->raw;
74 return internal ==
nullptr;
78 template <
typename handle_type>
96 if (!uv_is_closing((uv_handle_t*)&
uv_handle))
98 uv_close((uv_handle_t*)&
uv_handle, on_close);
103 static void on_close(uv_handle_t* handle)
close_ptr(Args &&... args)
Definition proxy.h:24
T * operator->()
Definition proxy.h:37
~close_ptr()
Definition proxy.h:29
T * release()
Definition proxy.h:42
proxy_ptr(const proxy_ptr< T > &that)
Definition proxy.h:56
proxy_ptr(proxy_ptr< T > &&that)
Definition proxy.h:57
bool is_null()
Definition proxy.h:72
proxy_ptr(Args &&... args)
Definition proxy.h:61
proxy_ptr(proxy_ptr< T > &that)
Definition proxy.h:55
proxy_ptr< T > & operator=(const proxy_ptr< T > &that)=default
T * operator->()
Definition proxy.h:65
proxy_ptr(std::nullptr_t that)
Definition proxy.h:58
with_uv_handle(with_uv_handle< handle_type > &&that)=delete
void close()
Definition proxy.h:94
virtual ~with_uv_handle()=default
with_uv_handle(const with_uv_handle< handle_type > &that)=delete
handle_type uv_handle
Definition proxy.h:82
with_uv_handle()
Definition proxy.h:84