Namespaces
Variants

std::chrono:: nonexistent_local_time

From cppreference.net
ヘッダーで定義 <chrono>
class nonexistent_local_time ;
(C++20以降)

存在しない std::chrono::local_time から std::chrono::sys_time への変換が、 std::chrono::choose (例: choose::earliest choose::latest など)を指定せずに行われたことを報告する例外としてスローされるオブジェクトの型を定義します。

この例外は std::chrono::time_zone::to_sys およびそれを呼び出す関数( std::chrono::local_time を引数に取る std::chrono::zoned_time のコンストラクタなど)によってスローされます。

cpp/error/exception cpp/error/runtime error std-chrono-nonexistent local time-inheritance.svg

継承図

目次

メンバー関数

(constructor)
例外オブジェクトを構築する
(public member function)
operator=
例外オブジェクトを置き換える
(public member function)
what
説明文字列を返す
(public member function)

std::chrono::nonexistent_local_time:: nonexistent_local_time

template < class Duration >

nonexistent_local_time ( const std:: chrono :: local_time < Duration > & tp,

const std:: chrono :: local_info & i ) ;
(1) (since C++20)
nonexistent_local_time ( const nonexistent_local_time & other ) noexcept ;
(2) (since C++20)

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

1) what() によって返される説明文字列は、以下のコード実行後の os.str() によって生成される文字列と同等です:
std::ostringstream os;
os << tp << " is in a gap between\n"
   << std::chrono::local_seconds(i.first.end.time_since_epoch()) + i.first.offset
   << ' ' << i.first.abbrev << " and\n"
   << std::chrono::local_seconds(i.second.begin.time_since_epoch()) + i.second.offset
   << ' ' << i.second.abbrev
   << " which are both equivalent to\n"
   << i.first.end << " UTC";
動作は未定義です、もし i. result ! = std :: chrono :: local_info :: nonexistent の場合。
2) コピーコンストラクタ。もし * this other の両方が動的型 std::chrono::nonexistent_local_time を持つ場合、 std:: strcmp ( what ( ) , other. what ( ) ) == 0 となります。

パラメータ

tp - 変換が試行された時間点
i - 変換試行の結果を記述する std::chrono::local_info
other - コピーする別の nonexistent_local_time

例外

std::bad_alloc をスローする可能性があります

注記

std::exception から派生した標準ライブラリクラスのコピーは例外をスローすることが許可されていないため、このメッセージは通常、内部で別途割り当てられた参照カウント文字列として格納されます。

std::chrono::nonexistent_locale_time:: operator=

nonexistent_locale_time & operator = ( const nonexistent_locale_time & other ) noexcept ;
(C++20以降)

other の内容を代入します。 * this other の両方が動的型 std::chrono::nonexistent_locale_time を持つ場合、代入後は std:: strcmp ( what ( ) , other. what ( ) ) == 0 となります。

パラメータ

other - 代入する別の例外オブジェクト

戻り値

* this

std::chrono::nonexistent_locale_time:: what

virtual const char * what ( ) const noexcept ;
(C++20以降)

説明文字列を返します。

戻り値

説明情報を含む実装定義のナル終端文字列へのポインタ。この文字列は std::wstring への変換と表示に適しています。ポインタは、少なくとも取得元の例外オブジェクトが破棄されるまで、または例外オブジェクトの非constメンバー関数(コピー代入演算子など)が呼び出されるまで有効であることが保証されます。

注記

実装は what() をオーバーライドすることが許可されていますが、必須ではありません。

std::exception から継承

メンバ関数

例外オブジェクトを破棄する
( std::exception の仮想公開メンバ関数)
[virtual]
説明文字列を返す
( std::exception の仮想公開メンバ関数)

関連項目

ローカル時間が曖昧であることを報告するためにスローされる例外
(クラス)