pop_front
语法:
1 |
void pop_front(); |
pop_front()删除双向队列头部的元素。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
源代码 /** * @brief Removes first element. * * This is a typical stack operation. It shrinks the %deque by one. * * Note that no data is returned, and if the first element's data is * needed, it should be retrieved before pop_front() is called. */ void pop_front() { if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_last - 1) { std::_Destroy(this->_M_impl._M_start._M_cur); ++this->_M_impl._M_start._M_cur; } else _M_pop_front_aux(); } |
测试代码
测试结果
1 1 1 9 9 9 9 9 9 9 9 9 9