Array PopFront Method C++

后端 未结 5 2033
说谎
说谎 2021-01-29 15:48

Trying not to lose it here. As you can see below I have assigned intFrontPtr to point to the first cell in the array. And intBackPtr to point to the last cell in the array...:

5条回答
  •  长发绾君心
    2021-01-29 16:08

    Can't you just use a std::list?

    That makes it really to pop from either end using pop_front or pop_back. You can also add to the front and the back. It also has the advantage that after popping from the front (or even removing from the middle of the list) you don't have to shift anything around (The link is simply removed) which makes it much more efficient than what you are, seemingly, proposing.

提交回复
热议问题