SafeCountable::m_count is mutable so that we can have safe_ptr<const T>

This commit is contained in:
Maxime Coste 2012-11-12 20:07:05 +01:00
parent 801f4e740c
commit 037210c70c

View File

@ -116,11 +116,11 @@ public:
SafeCountable() : m_count(0) {} SafeCountable() : m_count(0) {}
~SafeCountable() { assert(m_count == 0); } ~SafeCountable() { assert(m_count == 0); }
void inc_safe_count() { ++m_count; } void inc_safe_count() const { ++m_count; }
void dec_safe_count() { --m_count; assert(m_count >= 0); } void dec_safe_count() const { --m_count; assert(m_count >= 0); }
private: private:
int m_count; mutable int m_count;
}; };
// *** Containers helpers *** // *** Containers helpers ***