6#if defined _DEBUG && (defined _WIN32 || defined _WIN64)
9#define _CRTDBG_MAP_ALLOC
16 #ifdef _CRTDBG_MAP_ALLOC
17 _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
33 std::cout << std::format(
"default_ctor id {}, copies {}\n",
id_,
copies_);
41 std::cout << std::format(
"copy_ctor id {}, copies {}\n",
id_,
copies_);
48 std::cout << std::format(
"move_ctor id {}, copies {}\n",
id_,
copies_);
52 std::cout << std::format(
"dtor id {}, copies {}\n",
id_,
copies_);
59 std::cout << std::format(
"copy_op id {}, copies {}\n",
id_,
copies_);
66 std::cout << std::format(
"move_op id {}, copies {}\n",
id_,
copies_);
73 out << std::format(
"{{id: {}, copies: {}}}", obj.
id_, obj.
copies_);
DebugClass & operator=(DebugClass &&rhs) noexcept
DebugClass(const DebugClass &rhs)
DebugClass & operator=(const DebugClass &rhs)
static std::size_t globalId
DebugClass(DebugClass &&rhs) noexcept
friend std::ostream & operator<<(std::ostream &out, const DebugClass &obj)
std::shared_ptr< std::size_t > copyCounter_
void enableMemoryGuard()
Enable MSVC native memory leak checker in debug mode. Not compatible with address sanitizer.