c++ - Clear temporary list without clearing where I assign it to -


i have 'slate' current screen, in screen 'pages' hold 'items' 12 in size, because fit on screen, have tried check, once reaches 12 items, make new page, code listed below leaves no items in either page 1 or page 2

int pageitems = 0;     std::list<item*> templist; page* temp = new page;   (std::list<item*>::iterator iter = items.begin(); iter != items.end(); ++iter) {     templist.push_back((*iter));     if (pageitems >= 13) {         page_count++;         temp->items = templist;         pages.push_back(temp);         templist.clear();         temp->items.clear();         pageitems = 0;     }     pageitems++; } 

page class holds std::list, should handle 12, , new page created next amount, if goes above 12, new class , slate class holds std::list std::list, item 1 easier create class, because didnt have pages, , feed 'items' 'pages' according how many given slate

i think problem:

    temp->items.clear(); 

you seem clear page after adding list of pages


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -