running <list> inside a loop

I'm needing a <list> that will hold only four items yet allow me to continuously add to it with mylist.push_front(), is there a way to let a loop run four times before calling mylist.pop_back() and then running four more times, etc.?
1
2
3
4
5
while (true) {
    for(int i = 0; i < 4; ++i)
        mylist.push_front();
    mylist.pop_back();
}
Topic archived. No new replies allowed.