Share via


list::crbegin

逆順のリスト内の最初の要素を指す定数反復子を返します。

const_reverse_iterator rbegin( ) const;

戻り値

逆順の list クラス 内の最初の要素を指す定数逆順双方向反復子 (または通常の順序の list 内の最後の要素だったものを指す定数逆順双方向反復子)。

解説

crbegin は、list::begin が list で使用されるように、逆順のリストで使用されます。

戻り値が crbegin の場合、リスト オブジェクトは変更できません。 list::rbegin を使用して、リスト内を後方に向かって反復処理できます。

使用例

// list_crbegin.cpp
// compile with: /EHsc
#include <list>
#include <iostream>

int main( ) 
{
   using namespace std;
   list <int> c1;
   list <int>::const_reverse_iterator c1_crIter;

   c1.push_back( 10 );
   c1.push_back( 20 );
   c1.push_back( 30 );
   c1_crIter = c1.crbegin( );
   cout << "The last element in the list is " << *c1_crIter << "." << endl;
}
  

必要条件

ヘッダー: <list>

名前空間: std

参照

関連項目

list クラス

標準テンプレート ライブラリ