std::chrono::ambiguous_local_time
提供: cppreference.com
ヘッダ <chrono> で定義 | ||
class ambiguous_local_time; | (C++20以上) | |
std::chrono::choose (choose::earliest
または choose::latest
) を指定せずに曖昧な std::chrono::local_time を std::chrono::sys_time に変換しようとしたことを報告するために例外として投げられるオブジェクトの型を定義します。
この例外は std::chrono::time_zone::to_sys およびそれを呼ぶ関数 (std::chrono::local_time を取る std::chrono::zoned_time のコンストラクタなど) によって投げられます。
目次 |
[編集]メンバ関数
コンストラクタ | 例外オブジェクトを構築します (パブリックメンバ関数) |
std::chrono::ambiguous_local_time::ambiguous_local_time
template<class Duration > ambiguous_local_time(const std::chrono::local_time<Duration>& tp, | ||
例外オブジェクトを構築します。 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";
std::exception
から派生する標準ライブラリのクラスがコピーされる際に例外を投げることは許されないため、このメッセージは一般的には別に確保された参照カウント管理の文字列として内部的に格納されます。
i.result!= std::chrono::local_info::ambiguous の場合、動作は未定義です。
引数
tp | - | 変換が試みられた時点 |
i | - | 変換の試みの結果を記述する std::chrono::local_info |
例外
std::bad_alloc を投げる可能性があります。
std::exception から継承
メンバ関数
[仮想] | 例外オブジェクトを破棄します ( std::exception の仮想パブリックメンバ関数) |
[仮想] | 説明文字列を返します ( std::exception の仮想パブリックメンバ関数) |