名前空間
変種
操作

std::basic_string<CharT,Traits,Allocator>::max_size

提供: cppreference.com
< cpp‎ | string‎ | basic string
2020年2月18日 (火) 00:34時点におけるFruderica (トーク | 投稿記録)による版

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
 
 
 
std::basic_string
 
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以上)

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

目次

[編集] 引数

(なし)

[編集] 戻り値

最大文字数���

[編集] 計算量

一定。

[編集]

#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

[編集] 関連項目

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