呼び出し後priority_queueの変更によって返される const 参照(visual studio 2015)top()pop()
priority_queue<int> queue;
queue.push(1);
queue.push(2);
queue.push(3);
const int & m = queue.top();
cout << m << endl; // 3
queue.pop();
cout << m << endl; // 2
queue.pop();
cout << m << endl; // 1
でトップ値を取得するauto & m = queue.top();と、出力も になり3 2 1ます。
でトップ値を取得する場合auto m = queue.top();、出力は3 3 3です。
この背後にあるメカニズムは何ですか?