Delete the iterator's current element from the list. This operation will fail if the iterator is not the only one using the list's internal data area. In the event the deletion is successful, as the curent element then ceases to exist the current element is set to the next element in the list. The process calling delete on the iterator, should check if the deletion took place and if so, refrain from incrementing the iterator at the top of the iteration loop.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzList::Iter::Delete | (void) |
Declared and defined in file: hzTmplList.h
Function Logic:
Function body:
hzEcode hzList::Iter::Delete (void)
{
// Delete the iterator's current element from the list. This operation will fail if the iterator is not the only one using the list's internal data
// area. In the event the deletion is successful, as the curent element then ceases to exist the current element is set to the next element in the
// list. The process calling delete on the iterator, should check if the deletion took place and if so, refrain from incrementing the iterator at
// the top of the iteration loop.
//
// Returns: E_NOTFOUND If the iterator is not pointing to a list internal area.
// E_CONFLICT If there is more than one iterator, none can delete
// E_OK If the object was inserted
_hz_listitem<OBJ>* marker ; // List element pointer
hzEcode rc ; // Return code
if (!m_pHandle)
return E_NOTFOUND ;
if (m_pHandle->m_nIter > 1)
return E_CONFLICT ;
marker = m_pCurr->next ;
rc = m_pHandle->_delete(m_pCurr) ;
m_pCurr = marker ;
return rc ;
}