Refactoring in CCSet

This commit is contained in:
Andres Pagliano 2012-11-30 10:38:27 -03:00
parent 43cc383346
commit 8adb3eb6eb
1 changed files with 10 additions and 25 deletions

View File

@ -52,18 +52,7 @@ CCSet::CCSet(const CCSet &rSetObject)
CCSet::~CCSet(void) CCSet::~CCSet(void)
{ {
// call release() of elements removeAllObjects();
CCSetIterator iter;
for (iter = m_pSet->begin(); iter != m_pSet->end(); ++iter)
{
if (! (*iter))
{
break;
}
(*iter)->release();
}
CC_SAFE_DELETE(m_pSet); CC_SAFE_DELETE(m_pSet);
} }
@ -98,19 +87,15 @@ void CCSet::removeObject(CCObject *pObject)
void CCSet::removeAllObjects() void CCSet::removeAllObjects()
{ {
if (!m_pSet || m_pSet->empty())
{
return;
}
CCSetIterator it; CCSetIterator it;
for (it = m_pSet->begin(); it != m_pSet->end(); ++it) for (it = m_pSet->begin(); it != m_pSet->end(); ++it)
{ {
if(*it) if (! (*it))
{ {
removeObject(*it); break;
} }
(*it)->release();
} }
} }