msdn上的解析:
value_type& front( );
const value_type& front( ) const;
Returns a reference to the first element at the front of the queue.
請看下面示例代碼
queue<int> intqueue;
intqueue.push(1);
intqueue.push(2);
int head = intqueue.front();//int&可以隱式轉換為int?
intqueue.pop();//將對頭元素彈出隊列
cout << head << endl;//輸出1,front應該返回的是"引用",但pop之后,為什么head的輸出還有效(引用還有效?)?