13 lines
198 B
C++
13 lines
198 B
C++
#pragma once
|
|
|
|
#include <atomic>
|
|
|
|
typedef std::atomic<unsigned long> counter;
|
|
|
|
struct MaintainCount
|
|
{
|
|
counter & c;
|
|
MaintainCount(counter & c) : c(c) { c++; }
|
|
~MaintainCount() { c--; }
|
|
};
|