queue::back
Başvuru öğesi sıranın arkasındaki en son ve en son eklenen döndürür.
reference back( );
const_reference back( ) const;
Dönüş Değeri
Sıranın son öğesi.Sıra boş ise, dönüş değeri tanımlı değil.
Notlar
Dönüş değeri geri için atanmış bir const_reference, sıra nesnesi değiştirilemez.Dönüş değeri geri için atanmış bir başvuru, sıra nesnesinin değiştirilebilir.
Öğe boş bir sıra erişmeye çalışırsanız, 1 _secure_scl ile derlerken, çalışma zamanı hatası ortaya çıkar.Daha fazla bilgi için bkz. İşaretli Yineleyiciler.
Örnek
// queue_back.cpp
// compile with: /EHsc
#include <queue>
#include <iostream>
int main( )
{
using namespace std;
queue <int> q1;
q1.push( 10 );
q1.push( 11 );
int& i = q1.back( );
const int& ii = q1.front( );
cout << "The integer at the back of queue q1 is " << i
<< "." << endl;
cout << "The integer at the front of queue q1 is " << ii
<< "." << endl;
}
Çıktı
The integer at the back of queue q1 is 11.
The integer at the front of queue q1 is 10.
Gereksinimler
Başlık: <queue>
Namespace: std