std::basic_string<CharT,Traits,Allocator>::max_size
提供: cppreference.com
<tbody>
</tbody>
<tbody class="t-dcl-rev ">
</tbody><tbody>
</tbody>
size_type max_size() const; |
(C++11未満) | |
size_type max_size() const noexcept; |
(C++11以上) (C++20未満) |
|
constexpr size_type max_size() const noexcept; |
(C++20以上) | |
システムまたはライブラリ実装の制限による文字列が保持できる最大要素数を返します。
引数
(なし)
戻り値
最大文字数。
計算量
一定。
例
Run this code
#include <iostream>
#include <string>
int main()
{
std::string s;
std::cout << "Maximum size of a string is " << s.max_size() << "\n";
}
出力例:
Maximum size of a string is 4294967294
関連項目
| 文字数を返します (パブリックメンバ関数) |