Namespaces
Variants

std::chrono:: ambiguous_local_time

From cppreference.net
定義済みヘッダー <chrono>
class ambiguous_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-ambiguous local time-inheritance.svg

継承図

目次

メンバー関数

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

std::chrono::ambiguous_local_time:: ambiguous_local_time

template < class Duration >

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

const std:: chrono :: local_info & i ) ;
(1) (C++20以降)
ambiguous_local_time ( const ambiguous_local_time & other ) noexcept ;
(2) (C++20以降)

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

1) what ( ) によって返される説明文字列は、以下のコード実行後の os. str ( ) によって生成される文字列と同等です:
std::ostringstream os;
os << tp << " is ambiguous.  It could be\n"
   << tp << ' ' << i.first.abbrev << " == "
   << tp - i.first.offset << " UTC or\n"
   << tp << ' ' << i.second.abbrev  << " == "
   << tp - i.second.offset  << " UTC";
i. result ! = std :: chrono :: local_info :: ambiguous の場合、動作は未定義です。
2) コピーコンストラクタ。 * this other の両方が動的型 std::chrono::ambiguous_local_time を持つ場合、 std:: strcmp ( what ( ) , other. what ( ) ) == 0 となります。

パラメータ

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

例外

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

注記

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

std::chrono::ambiguous_locale_time:: operator=

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

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

パラメータ

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

戻り値

* this

std::chrono::ambiguous_locale_time:: what

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

説明文字列を返します。

戻り値

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

注記

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

std::exception から継承

メンバ関数

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

関連項目

存在しないローカルタイムを報告するためにスローされる例外
(クラス)