public CFastList() { m_pHeader = m_pEnd = new CFastListNode(); m_pEnd.m_pLast = m_pEnd; m_nCount = 0; m_pEndItera = new iterator(m_pEnd); }
public void erase(iterator itWhere) { if (itWhere != m_pEndItera) { CFastListNode pNode = itWhere.get_ptr(); if (pNode == m_pHeader) { m_pHeader = m_pHeader.m_pNext; m_pHeader.m_pLast = null; if (m_pHeader == m_pEnd) { m_pEnd.m_pLast = m_pEnd; } } else { if (pNode.m_pLast != null) { pNode.m_pLast.m_pNext = pNode.m_pNext; } if (pNode.m_pNext != null) { pNode.m_pNext.m_pLast = pNode.m_pLast; } } pNode.m_pLast = null; pNode.m_pNext = null; --m_nCount; } }
public void pop_front() { if (m_pHeader != m_pEnd && m_nCount > 0) { m_pHeader = m_pHeader.m_pNext; --m_nCount; } }
public void swap(CFastList <_Ty> other) { CFastListNode temp = null; temp = m_pHeader; m_pHeader = other.m_pHeader; other.m_pHeader = temp; temp = m_pEnd; m_pEnd = other.m_pEnd; other.m_pEnd = temp; iterator pIt = null; pIt = m_pEndItera; m_pEndItera = other.m_pEndItera; other.m_pEndItera = pIt; int nTemp = 0; nTemp = m_nCount; m_nCount = other.m_nCount; other.m_nCount = nTemp; }
public void clear() { CFastListNode pNode = null; while (m_pHeader != m_pEnd) { pNode = m_pHeader; m_pHeader = m_pHeader.m_pNext; pNode.m_pLast = null; pNode.m_pNext = null; } m_pHeader = m_pEnd; m_pEnd.m_pLast = m_pEnd; m_nCount = 0; }
public void pop_back() { if (m_nCount > 0) { CFastListNode pNode = m_pEnd; if (pNode.m_pLast != null) { pNode.m_pLast.m_pNext = m_pEnd; } m_pEnd.m_pLast = pNode.m_pLast; --m_nCount; pNode.m_pLast = null; pNode.m_pNext = null; } }
public void push_back(CFastListNode pNode) { if (0 == m_nCount) { m_pHeader = pNode; pNode.m_pNext = m_pEnd; m_pEnd.m_pLast = pNode; } else { pNode.m_pLast = m_pEnd.m_pLast; pNode.m_pLast.m_pNext = pNode; pNode.m_pNext = m_pEnd; m_pEnd.m_pLast = pNode; } ++m_nCount; }
public void push_back(_Ty value) { CFastListNode pNode = new CFastListNode(); pNode.m_value = value; if (0 == m_nCount) { m_pHeader = pNode; pNode.m_pNext = m_pEnd; m_pEnd.m_pLast = pNode; } else { pNode.m_pLast = m_pEnd.m_pLast; pNode.m_pLast.m_pNext = pNode; pNode.m_pNext = m_pEnd; m_pEnd.m_pLast = pNode; } ++m_nCount; }
public iterator(CFastListNode pNode) { m_pNode = pNode; }