• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <chrono>

    std::chrono::month::operator unsigned int

    constexpr explicit operator unsigned int() const noexcept; // (1) C++20
    

    概要

    monthオブジェクトをunsigned int型に明示的に変換する。

    戻り値

    • (1) : メンバ変数として保持しているunsigned int型としての月の値を返す

    #include <cassert>
    #include <chrono>
    
    namespace chrono = std::chrono;
    
    int main()
    {
      auto m = static_cast<unsigned int>(chrono::December);
      assert(m == 12);
    }
    

    出力

    バージョン

    言語

    • C++20

    処理系