名前空間
変種
操作

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

提供: cppreference.com
< cpp‎ | string‎ | basic string
 
 
 
std::basic_string
 
size_type max_size()const;
(C++11未満)
size_type max_size()constnoexcept;
(C++11以上)
(C++20未満)
constexpr size_type max_size()constnoexcept;
(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]
close