mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
Add deleter struct for std::unique_ptr destruction policy
This commit is contained in:
parent
264608b621
commit
1fe8d93612
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
#include "libimp/aligned.h"
|
#include "libimp/aligned.h"
|
||||||
#include "libimp/uninitialized.h"
|
#include "libimp/uninitialized.h"
|
||||||
@ -167,4 +168,13 @@ void $delete(T *p) noexcept {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \brief The destruction policy used by std::unique_ptr.
|
||||||
|
/// \see https://en.cppreference.com/w/cpp/memory/default_delete
|
||||||
|
struct deleter {
|
||||||
|
template <typename T>
|
||||||
|
void operator()(T *p) const noexcept {
|
||||||
|
$delete(p);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
LIBPMR_NAMESPACE_END_
|
LIBPMR_NAMESPACE_END_
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user