unique_ptr deleter using LocalFree added
This commit is contained in:
parent
7049fc0af8
commit
8dd01573d4
@ -196,6 +196,62 @@ namespace winstd
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Deleter for unique_ptr using LocalFree
|
||||||
|
///
|
||||||
|
template <class _Ty> struct LocalFree_delete
|
||||||
|
{
|
||||||
|
typedef LocalFree_delete<_Ty> _Myt;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Default construct
|
||||||
|
///
|
||||||
|
LocalFree_delete() {}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Construct from another LocalFree_delete
|
||||||
|
///
|
||||||
|
template <class _Ty2> LocalFree_delete(const LocalFree_delete<_Ty2>&) {}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Delete a pointer
|
||||||
|
///
|
||||||
|
void operator()(_Ty *_Ptr) const
|
||||||
|
{
|
||||||
|
LocalFree(_Ptr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Deleter for unique_ptr to array of unknown size using LocalFree
|
||||||
|
///
|
||||||
|
template <class _Ty> struct LocalFree_delete<_Ty[]>
|
||||||
|
{
|
||||||
|
typedef LocalFree_delete<_Ty> _Myt;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Default construct
|
||||||
|
///
|
||||||
|
LocalFree_delete() {}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Delete a pointer
|
||||||
|
///
|
||||||
|
void operator()(_Ty *_Ptr) const
|
||||||
|
{
|
||||||
|
LocalFree(_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Delete a pointer of another type
|
||||||
|
///
|
||||||
|
template<class _Other>
|
||||||
|
void operator()(_Other *) const
|
||||||
|
{
|
||||||
|
LocalFree(_Ptr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \defgroup WinStdSysHandles System Handles
|
/// \defgroup WinStdSysHandles System Handles
|
||||||
/// Simplifies work with object handles of various type
|
/// Simplifies work with object handles of various type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user