std::out_of_range
提供: cppreference.com
ヘッダ <stdexcept> で定義
|
||
class out_of_range; |
||
例外として投げられるオブジェクトの型を定義します。 この例外は定義されている範囲外の要���にアクセスしようとした結果のエラーを報告します。
この例外は std::bitset および std::basic_string のメンバ関数、 std::stoi および std::stod ファミリーの関数、範囲チェック付きのメンバアクセス関数 (std::vector::at および std::map::at) によって投げられる場合があります。
目次 |
[編集] メンバ関数
コンストラクタ |
例外オブジェクトを構築します (パブリックメンバ関数) |
std::out_of_range::out_of_range
explicit out_of_range( const std::string& what_arg ); |
(1) | |
explicit out_of_range( const char* what_arg ); |
(2) | (C++11以上) |
what() でアクセス可能な説明文字列として what_arg
を持つ例外オブジェクトを構築します。
std::out_of_range
のコピーが例外を投げることは許されないため、このメッセージは内部的には一般的に別に確保された参照カウント管理の文字列として格納されます。 これは std::string&&
を取るコンストラクタが無い理由でもあります。 どのみち内容をコピーしなければならないのです。
引数
what_arg | - | 説明文字列 |
例外
std::bad_alloc を投げる場合があります
std::exception から継承
メンバ関数
[仮想] |
例外オブジェクトを破棄します ( std::exception の仮想パブリックメンバ関数)
|
[仮想] |
説明文字列を返します ( std::exception の仮想パブリックメンバ関数)
|
[編集] ノート
標準のエラー状態 std::errc::result_out_of_range は、一般的に入力ではなく結果が範囲外であることを表し、 std::range_error および ERANGE により密接に関連します。
[編集] 関連項目
境界チェック付きで指定された文字にアクセスします ( std::basic_string<CharT,Traits,Allocator> のパブリックメンバ関数)
|