名前空間
変種
操作

std::chrono::nonexistent_local_time

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

存在しない std::chrono::local_time を、std::chrono::choose(例えば choose::earliestchoose::latest)を指定せずに std::chrono::sys_time に変換しようとしたことを報告するために例外としてスローされるオブジェクトの型を定義します。

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

cpp/error/exceptioncpp/error/runtime errorstd-chrono-nonexistent local time-inheritance.svg

継承図

目次

[編集] メンバ関数

(コンストラクタ)
例外オブジェクトを構築する
(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) (C++20以降)
nonexistent_local_time( const nonexistent_local_time& other ) noexcept;
(2) (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) コピーコンストラクタ。 *thisother が両方とも動的型 std::chrono::nonexistent_local_time を持つ場合、 std::strcmp(what(), other.what()) == 0 です。

パラメータ

tp - 変換が試みられた時刻点
i - 変換試行の結果を記述する std::chrono::local_info
その他 - コピー元の別の 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 の内容をこのオブジェクトに代入します。 *thisother が両方とも動的型 std::chrono::nonexistent_locale_time を持つ場合、代入後、 std::strcmp(what(), other.what()) == 0 です。

パラメータ

その他 - 割り当てる別の例外オブジェクト

戻り値

*this

std::chrono::nonexistent_locale_time::what

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

説明文字列を返します。

戻り値

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

返された文字列は、定数評価中に通常のリテラルエンコーディングでエンコードされます。

(C++26以降)

注釈

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

std::runtime_error から継承


std::exception から継承

メンバ関数

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

[編集] 関連項目

ローカル時刻が曖昧であることを報告するためにスローされる例外
(クラス) [編集]
English 日本語 中文(简体) 中文(繁體)