Translations of this page?:

push_back

文法:

    #include <vector>
    void push_back( const T& val );

push_back()関数はベクタの最後尾にvalを追加します。 例えば、次のコードは10個の整数をベクタに加えます:

     vector<int> the_vector;
     for( int i = 0; i < 10; i++ ) {
       the_vector.push_back( i );
     }

このベクタを表示すると以下のようになるでしょう:

   0 1 2 3 4 5 6 7 8 9

push_back()は最高でconstant timeで動作します。

関連トピック: assign, insert, pop_back

 
• • • SitemapRecent changesRSScc