mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-10-08 20:04:02 +00:00
[libc++] Counter<T>'s assignment operator shouldn't ++gConstructed
This has been here since d5f461ca03
, but assigning into an existing
Counter object definitely doesn't create a new object. This causes the
count to "leak" higher and higher, inside algorithms based on swapping.
This commit is contained in:
parent
755535b5eb
commit
a9f384994b
@ -25,7 +25,7 @@ public:
|
||||
Counter& operator=(const Counter& rhs) { data_ = rhs.data_; return *this; }
|
||||
#if TEST_STD_VER >= 11
|
||||
Counter(Counter&& rhs) : data_(std::move(rhs.data_)) { ++gConstructed; }
|
||||
Counter& operator=(Counter&& rhs) { ++gConstructed; data_ = std::move(rhs.data_); return *this; }
|
||||
Counter& operator=(Counter&& rhs) { data_ = std::move(rhs.data_); return *this; }
|
||||
#endif
|
||||
~Counter() { --gConstructed; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user