名前空間
変種
操作

std::unordered_set<Key,Hash,KeyEqual,Allocator>::max_size

提供: cppreference.com
 
 
 
 
size_type max_size() const noexcept;
(C++11以上)

システムまたはライブラリ実装の制限によるコンテナが保持できる最大要素数を返します。

目次

[編集] 引数

(なし)

[編集] 戻り値

最大要素数。

[編集] 計算量

一定。

[編集] ノート

この値は一般的にはコンテナのサイズの理論上の制限を反映します (多くとも std::numeric_limits<difference_type>::max())。 実行時の利用可能な RAM の量により、コンテナのサイズは max_size() より小さな値に制限される場合があります。

[編集]

#include <iostream>
#include <unordered_set>
 
int main()
{
    std::unordered_set<char> s;
    std::cout << "Maximum size of a 'unordered_set' is " << s.max_size() << "\n";
}

出力例:

Maximum size of a 'unordered_set' is 768614336404564650

関連項目

要素数を返します
(パブリックメンバ関数) [edit]