push_front
语法:
1 |
void push_front( const TYPE &val ); |
push_front()函数在双向队列的头部加入一个值为val的元素。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
源代码 /** * @brief Add data to the end of the %deque. * @param x Data to be added. * * This is a typical stack operation. The function creates an element at * the end of the %deque and assigns the given data to it. Due to the * nature of a %deque this operation can be done in constant time. */ void push_back(const value_type& __x) { if (this->_M_impl._M_finish._M_cur != this->_M_impl._M_finish._M_last - 1) { std::_Construct(this->_M_impl._M_finish._M_cur, __x); ++this->_M_impl._M_finish._M_cur; } else _M_push_back_aux(__x); } |
测试代码
测试结果
1 9 9 9 9 9 9 9 9 9 9