15#ifndef CPL_AUTO_CLOSE_H_INCLUDED
16#define CPL_AUTO_CLOSE_H_INCLUDED
18#if defined(__cplusplus)
35 static_assert(!std::is_const<_Ty>::value && std::is_pointer<_Ty>::value,
36 "_Ty must is pointer type,_Dx must is function type");
53 : m_ResourcePtr(ptr), m_CloseFunc(dt)
62 if (m_ResourcePtr && m_CloseFunc)
63 m_CloseFunc(m_ResourcePtr);
67#define CPL_AUTO_CLOSE_WARP(hObject, closeFunc) \
68 CPLAutoClose<decltype(hObject), decltype(closeFunc) *> \
69 tAutoClose##hObject(hObject, closeFunc)
The class use the destructor to automatically close the resource.
Definition: cpl_auto_close.h:34
CPLAutoClose(_Ty &ptr, _Dx dt)
Constructor.
Definition: cpl_auto_close.h:52
~CPLAutoClose()
Destructor.
Definition: cpl_auto_close.h:60