forked from vmangos/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Discover new and exciting ways how to leak memory by using this struct.
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef MANGOS_NO_DELETER_H | ||
#define MANGOS_NO_DELETER_H | ||
|
||
namespace MaNGOS { namespace Memory | ||
{ | ||
/// A non deleter implementation that can be used in std::shared_ptr | ||
/// \warning Using this will result in a memory leak, if not managed otherwise! | ||
/// \example std::shared_ptr<uint8_t> mySharedPtr = std::shared_ptr<uint8_t>(new uint8_t[1024], MaNGOS::Memory::no_deleter<uint8_t>()); | ||
template<typename T> | ||
struct no_deleter | ||
{ | ||
void operator()(T const*) | ||
{ | ||
// Ignore. No call to `delete` | ||
} | ||
}; | ||
}} // namespace MaNGOS::Memory | ||
|
||
#endif //MANGOS_NO_DELETER_H |