次の方法で共有


vector::cend

末尾超え反復子を返します。

const_iterator cend( ) const;

戻り値

vector Classの定数末尾超え反復子。vector が空の場合、vector::cend() == vector::cbegin()。

解説

cend (適切にデクリメント済み) の戻り値で vector オブジェクトを変更することはできません。

使用例

// vector_cend.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>
int main( )
{
   using namespace std;
   vector <int> v1;
   vector <int>::const_iterator v1_Iter;
   
   v1.push_back( 1 );
   v1.push_back( 2 );

   for ( v1_Iter = v1.cbegin( ) ; v1_Iter != v1.cend( ) ; v1_Iter++ )
      cout << *v1_Iter << endl;
}
  

必要条件

ヘッダー: <vector>

名前空間: std

参照

関連項目

vector Class

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