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

履歴 編集

function
<chrono>

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

weekday_indexed() = default;                            // (1) C++20
constexpr weekday_indexed(const chrono::weekday& wd,
                          unsigned int index) noexcept; // (2) C++20

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

概要

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

効果

  • (1) :
  • (2) :
    • wdindexをメンバ変数として保持する
    • !wd.ok()もしくはindexの値範囲が[0, 7]に含まれなければ、それぞれの保持される値は未規定

例外

投げない

#include <cassert>
#include <chrono>

namespace chrono = std::chrono;

int main() {
  chrono::weekday_indexed wi{chrono::Sunday, 1};
  assert(wi.weekday() == chrono::Sunday);
  assert(wi.index() == 1);
}

出力

バージョン

言語

  • C++20

処理系

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

参照