• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <chrono>

    std::chrono::year::operator+

    constexpr year operator+() const noexcept;
    

    概要

    正の符号。

    なにもせず、*thisをそのまま返す。

    戻り値

    *this

    #include <cassert>
    #include <chrono>
    
    namespace chrono = std::chrono;
    
    int main()
    {
      chrono::year y1_base{-1000};
      chrono::year y2_base{2020};
    
      chrono::year y1 = +y1_base;
      chrono::year y2 = +y2_base;
    
      assert(y1 == chrono::year{-1000});
      assert(y2 == chrono::year{2020});
    }
    

    出力

    バージョン

    言語

    • C++20

    処理系