名前空間
変種
操作

std::exception::exception

提供: cppreference.com
< cpp‎ | error‎ | exception
 
 
ユーティリティライブラリ
 
 
 
(1)
exception() throw();
(C++11未満)
exception() noexcept;
(C++11以上)
(2)
exception( const exception& other ) throw();
(C++11未満)
exception( const exception& other ) noexcept;
(C++11以上)

新しい例外オブジェクトを構築します。

1) デフォルトコンストラクタ。 what() は処理系定義の文字列を返します。
2) コピーコンストラクタ。 other の内容で内容を初期化します。 *thisother がどちらも同じ動的型 std::exception であれば、 std::strcmp(what(), other.what()) == 0 です。 (C++11以上)

[編集] 引数

other-内容を代入する別の例外

[編集] ノート

std::exception はコピーされる際に例外を投げることが許されないため、派生クラス (std::runtime_error など) がユーザ定義の診断メッセージを管理する必要がある場合、それは一般的にコピーオンライト文字列として実装されます。