31 #ifndef CPL_AUTO_CLOSE_H_INCLUDED 32 #define CPL_AUTO_CLOSE_H_INCLUDED 34 #if defined(__cplusplus) 35 #include <type_traits> 50 template<
typename _Ty,
typename _Dx>
52 static_assert( !std::is_const<_Ty>::value && std::is_pointer<_Ty>::value,
53 "_Ty must is pointer type,_Dx must is function type");
75 if(m_ResourcePtr && m_CloseFunc)
76 m_CloseFunc(m_ResourcePtr);
80 #define CPL_AUTO_CLOSE_WARP(hObject,closeFunc) \ 81 CPLAutoClose<decltype(hObject),decltype(closeFunc)*> tAutoClose##hObject(hObject,closeFunc) The class use the destructor to automatically close the resource.
Definition: cpl_auto_close.h:51
CPLAutoClose(_Ty &ptr, _Dx dt)
Constructor.
Definition: cpl_auto_close.h:66
~CPLAutoClose()
Destructor.
Definition: cpl_auto_close.h:73