Skip to content
Snippets Groups Projects
Commit 62cf550d authored by Jan Trávníček's avatar Jan Trávníček
Browse files

propper naming

parent 15823ad1
No related branches found
No related tags found
No related merge requests found
...@@ -35,13 +35,13 @@ public: ...@@ -35,13 +35,13 @@ public:
} }
   
~cow_shared_ptr ( ) noexcept { ~cow_shared_ptr ( ) noexcept {
deattach ( ); detach ( );
} }
   
cow_shared_ptr<T> & operator = ( const cow_shared_ptr<T> & other ) { cow_shared_ptr<T> & operator = ( const cow_shared_ptr<T> & other ) {
if(this == &other) return *this; if(this == &other) return *this;
   
deattach ( ); detach ( );
attach ( other.m_Data ); attach ( other.m_Data );
   
return *this; return *this;
...@@ -89,7 +89,7 @@ private: ...@@ -89,7 +89,7 @@ private:
if(m_Data) m_Data->m_UseCount++; if(m_Data) m_Data->m_UseCount++;
} }
   
void deattach ( ) { void detach ( ) {
if(m_Data && --(m_Data->m_UseCount) <= 0) delete m_Data; if(m_Data && --(m_Data->m_UseCount) <= 0) delete m_Data;
m_Data = NULL; m_Data = NULL;
} }
...@@ -98,7 +98,7 @@ private: ...@@ -98,7 +98,7 @@ private:
if(unique( )) return; if(unique( )) return;
   
T* tmp = m_Data; T* tmp = m_Data;
deattach( ); detach( );
attach(clone(tmp)); attach(clone(tmp));
} }
   
...@@ -151,13 +151,13 @@ public: ...@@ -151,13 +151,13 @@ public:
} }
   
~cow_shared_ptr ( ) noexcept { ~cow_shared_ptr ( ) noexcept {
deattach ( ); detach ( );
} }
   
cow_shared_ptr<T> & operator = ( const cow_shared_ptr<T> & other ) { cow_shared_ptr<T> & operator = ( const cow_shared_ptr<T> & other ) {
if(this == &other) return *this; if(this == &other) return *this;
   
deattach ( ); detach ( );
attach ( other.m_Data ); attach ( other.m_Data );
   
return *this; return *this;
...@@ -205,7 +205,7 @@ private: ...@@ -205,7 +205,7 @@ private:
if(m_Data) m_Data->m_UseCount++; if(m_Data) m_Data->m_UseCount++;
} }
   
void deattach ( ) { void detach ( ) {
if(m_Data && --(m_Data->m_UseCount) <= 0) delete m_Data; if(m_Data && --(m_Data->m_UseCount) <= 0) delete m_Data;
m_Data = NULL; m_Data = NULL;
} }
...@@ -214,7 +214,7 @@ private: ...@@ -214,7 +214,7 @@ private:
if(unique( )) return; if(unique( )) return;
   
typename cow_shared_ptr<T>::cow_shared_ptr_data* tmp = m_Data; typename cow_shared_ptr<T>::cow_shared_ptr_data* tmp = m_Data;
deattach( ); detach( );
attach(new cow_shared_ptr_data(clone(tmp))); attach(new cow_shared_ptr_data(clone(tmp)));
} }
   
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment