◐ Shell
clean mode source ↗

std::length_error - cppreference.com

提供: cppreference.com

<tbody> </tbody>

例外として投げられるオブジェクトの型を定義します。 この例外は何らかのオブジェクトに対する処理系定義の長さの制限を超過しようとした結果生じるエラーを報告します。

この例外は std::basic_string のメンバ関数および std::vector::reserve によって投げられます。

cpp/error/exceptioncpp/error/logic error

継承図

メンバ関数

std::length_error::length_error

<tbody> </tbody>

explicit length_error( const std::string& what_arg );

(1)

explicit length_error( const char* what_arg );

(2) (C++11以上)

what() でアクセス可能な説明文字列として what_arg を持つ例外オブジェクトを構築します。

std::length_error のコピーが例外を投げることは許されないため、このメッセージは内部的には一般的に別に確保された参照カウント管理の文字列として格納されます。 これは std::string&& を取るコンストラクタが無い理由でもあります。 どのみち内容をコピーしなければならないのです。

引数

例外

std::bad_alloc を投げる場合があります

関連項目

格納されている文字の数を変更します
(std::basic_string<CharT,Traits,Allocator>のパブリックメンバ関数) [edit]