Пример #1
0
int main() {
    DoublyLinkedList<int> d;
    d.append(7);
    d.append(8);
    d.append(9);
    d.append(10);
    d.insert(1,0);
    d.insert(12,d.size());
    d.insert(3,3);
    d.print();
    cout<<"Size = "<<d.size()<<"\n";
    return 0;
}
Пример #2
0
inline void TakeIfUnmarked::operator()(MarkedBlock* block)
{
    if (!block->markCountIsZero())
        return;

    m_markedSpace->allocatorFor(block).removeBlock(block);
    m_empties.append(block);
}
Пример #3
0
 //Metodo para invertir las notas en la estructura de lista doblemente enlazada.
 void invertirListaDoblementeEnlazada(){
     Nota temp;
     for(int i=0 ; i<listaDoblementeEnlazada.length() ; i++){
         temp = listaDoblementeEnlazada.remove(i);
         pila.push(temp);
     }
     while(pila.length()!=0){
         listaDoblementeEnlazada.append(pila.pop() );
     }
 }
Пример #4
0
void MarkedSpace::shrink()
{
    // We record a temporary list of empties to avoid modifying m_blocks while iterating it.
    DoublyLinkedList<MarkedBlock> empties;

    BlockIterator end = m_blocks.end();
    for (BlockIterator it = m_blocks.begin(); it != end; ++it) {
        MarkedBlock* block = *it;
        if (block->isEmpty()) {
            SizeClass& sizeClass = sizeClassFor(block->cellSize());
            sizeClass.blockList.remove(block);
            sizeClass.nextBlock = sizeClass.blockList.head();
            empties.append(block);
        }
    }
    
    freeBlocks(empties);
    ASSERT(empties.isEmpty());
}