次の方法で共有


<vector>

コンテナー クラス テンプレート ベクトルと、いくつかのサポート用テンプレートを定義します。

vector 指定された型の要素を直線上のシーケンスに編成するコンテナーです。 このシーケンスでは、任意の要素を高速にランダム アクセスしたり、動的に追加および削除したりできます。 vector は、ランダム アクセスのパフォーマンスを重視するシーケンスに適したコンテナーです。

Note

<vector> ライブラリでは、#include <initializer_list> ステートメントも使用されます。

クラス vector の詳細については、「vector クラス」を参照してください。 特殊化vector<bool>の詳細については、クラスを参照してくださいvector<bool>

構文

namespace std {
template <class Type, class Allocator>
class vector;
template <class Allocator>
class vector<bool>;

template <class Allocator>
struct hash<vector<bool, Allocator>>;

// TEMPLATE FUNCTIONS
template <class Type, class Allocator>
bool operator== (
    const vector<Type, Allocator>& left,
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>
bool operator!= (
    const vector<Type, Allocator>& left,
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>
bool operator<(
    const vector<Type, Allocator>& left,
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>
bool operator> (
    const vector<Type, Allocator>& left,
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>
bool operator<= (
    const vector<Type, Allocator>& left,
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>
bool operator>= (
    const vector<Type, Allocator>& left,
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>
void swap (
    vector<Type, Allocator>& left,
    vector<Type, Allocator>& right);

}  // namespace std

パラメーター

Type
ベクター内に格納されるデータ型に対するテンプレート パラメーター。

Allocator
メモリの割り当てと解放を担当する格納されたアロケーター オブジェクトのテンプレート パラメーター。

left
比較演算の最初の (左辺の) ベクター

right
比較演算の 2 つ目の (右辺の) ベクター。

メンバー

演算子

名前 説明
operator! = 演算子の vector 左側のオブジェクトが右側のオブジェクトと等しくない vector かどうかをテストします。
operator< 演算子の左側の vector オブジェクトが右側の vector オブジェクトより小さいかどうかを調べます。
operator<= 演算子の左側の vector オブジェクトが右側の vector オブジェクト以下かどうかを調べます。
operator== 演算子の左側の vector オブジェクトが右側の vector オブジェクトと等しいかどうかを調べます。
operator> 演算子の左側の vector オブジェクトが右側の vector オブジェクトより大きいかどうかを調べます。
operator>= 演算子の左側の vector オブジェクトが右側の vector オブジェクト以上であるかどうかを調べます。

クラス

名前 説明
vector クラス 特定の型の要素を線形配置で配置し、任意の要素への高速ランダム アクセスを許可するシーケンス コンテナーのクラス テンプレート。

特殊化

名前 説明
ハッシュ ベクターのハッシュを返します。
vector<bool> クラス クラス テンプレート vector を型 bool の要素に対して完全に特殊化したもので、基になる型のアロケーターを特殊化で使用します。

必要条件

ヘッダー:<vector>

名前空間std:

関連項目

ヘッダー ファイル リファレンス
C++ 標準ライブラリ内のスレッド セーフ
C++ 標準ライブラリ リファレンス