最終更新日時(UTC):
が更新

履歴 編集

function
<chrono>

std::chrono::month::コンストラクタ(C++20)

month() = default;                                 // (1) C++20
constexpr explicit month(unsigned int m) noexcept; // (2) C++20

month(const month&) = default;                     // (3) C++20
month(month&&) = default;                          // (4) C++20

概要

  • (1) : デフォルトコンストラクタ
  • (2) : 月を指定してmonthオブジェクトを構築する
  • (3) : コピーコンストラクタ
  • (4) : ムーブコンストラクタ

効果

  • (1) :
  • (2) :
    • mを、月を表す値としてメンバ変数に保持する
    • 通常は[1, 12]の範囲内で指定するが、それを超えてもよい
    • m[0, 255]の範囲外である場合、保持される値は未規定となる

例外

投げない

#include <cassert>
#include <chrono>

namespace chrono = std::chrono;

int main()
{
  chrono::month m{1};
  assert(m == chrono::January);
}

出力

バージョン

言語

  • C++20

処理系

  • Clang: 8.0
  • GCC: (9.2時点で実装なし)
  • Visual C++: (2019 Update 3時点で実装なし)