From f78fccb3cc8c2375bd0b474a33c43b1cd22a325c Mon Sep 17 00:00:00 2001 From: weidai Date: Sat, 19 Jun 2004 08:28:09 +0000 Subject: port to GCC 3.4 --- smartptr.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'smartptr.h') diff --git a/smartptr.h b/smartptr.h index c4f95753..f5630012 100644 --- a/smartptr.h +++ b/smartptr.h @@ -6,7 +6,7 @@ NAMESPACE_BEGIN(CryptoPP) -template class simple_ptr +template class simple_ptr { public: simple_ptr() : m_p(NULL) {} @@ -14,7 +14,7 @@ public: T *m_p; }; -template class member_ptr +template class member_ptr { public: explicit member_ptr(T *p = NULL) : m_p(p) {} @@ -62,14 +62,14 @@ public: value_ptr& operator=(const value_ptr& rhs); bool operator==(const value_ptr& rhs) { - return (!m_p && !rhs.m_p) || (m_p && rhs.m_p && *m_p == *rhs.m_p); + return (!this->m_p && !rhs.m_p) || (this->m_p && rhs.m_p && *this->m_p == *rhs.m_p); } }; template value_ptr& value_ptr::operator=(const value_ptr& rhs) { - T *old_p = m_p; - m_p = rhs.m_p ? new T(*rhs.m_p) : NULL; + T *old_p = this->m_p; + this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL; delete old_p; return *this; } @@ -89,8 +89,8 @@ public: template clonable_ptr& clonable_ptr::operator=(const clonable_ptr& rhs) { - T *old_p = m_p; - m_p = rhs.m_p ? rhs.m_p->Clone() : NULL; + T *old_p = this->m_p; + this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL; delete old_p; return *this; } @@ -190,32 +190,32 @@ template class vector_member_ptrs { public: vector_member_ptrs(unsigned int size=0) - : _size(size) {ptr = new member_ptr[_size];} + : m_size(size), m_ptr(new member_ptr[size]) {} ~vector_member_ptrs() - {delete [] ptr;} + {delete [] this->m_ptr;} member_ptr& operator[](unsigned int index) - {assert(index<_size); return ptr[index];} + {assert(indexm_size); return this->m_ptr[index];} const member_ptr& operator[](unsigned int index) const - {assert(index<_size); return ptr[index];} + {assert(indexm_size); return this->m_ptr[index];} - unsigned int size() const {return _size;} + unsigned int size() const {return this->m_size;} void resize(unsigned int newSize) { member_ptr *newPtr = new member_ptr[newSize]; - for (unsigned int i=0; im_size && im_ptr[i].release()); + delete [] this->m_ptr; + this->m_size = newSize; + this->m_ptr = newPtr; } private: vector_member_ptrs(const vector_member_ptrs &c); // copy not allowed void operator=(const vector_member_ptrs &x); // assignment not allowed - unsigned int _size; - member_ptr *ptr; + unsigned int m_size; + member_ptr *m_ptr; }; NAMESPACE_END -- cgit v1.2.1