list::cend
傳回處理成功最後一個項目的位置在清單的 const Iterator。
const_iterator cend( ) const;
傳回值
解決成功最後一個項目的位置。 list Class的 const 雙向 Iterator。 如果 list 是 null,則 list::cend == list::begin。
備註
cend 用來測試 Iterator 是否已到達其 list的結尾。
範例
// list_cend.cpp
// compile with: /EHsc
#include <list>
#include <iostream>
int main( )
{
using namespace std;
list <int> c1;
list <int>::const_iterator c1_cIter;
c1.push_back( 10 );
c1.push_back( 20 );
c1.push_back( 30 );
c1_cIter = c1.cend( );
c1_cIter--;
cout << "The last integer of c1 is " << *c1_cIter << endl;
}
需求
標題: <list>
命名空間: std