Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::chrono::weekday_indexed

      From cppreference.com
      <cpp‎ |chrono
       
       
      Date and time library
      Calendar
      (C++20)
      (C++20)
      (C++20)
      (C++20)
      (C++20)
      weekday_indexed
      (C++20)
      (C++20)
      (C++20)
      (C++20)(C++20)
      chrono I/O
      (C++20)

       
       
      Defined in header<chrono>
      class weekday_indexed;
      (since C++20)

      The classweekday_indexed combines aweekday, representing a day of the week in theproleptic Gregorian calendar, with a small indexn in the range[15]. It represents the first, second, third, fourth, or fifth weekday of some month.

      weekday_indexed is aTriviallyCopyableStandardLayoutType.

      Contents

      [edit]Member functions

      constructs aweekday_indexed
      (public member function)[edit]
      access the storedweekday
      (public member function)[edit]
      access the stored index
      (public member function)[edit]
      checks if the weekday and index are both valid
      (public member function)[edit]

      [edit]Nonmember functions

      (C++20)
      compares twoweekday_indexed values
      (function)[edit]
      (C++20)
      outputs aweekday_indexed into a stream
      (function template)[edit]

      [edit]Helper classes

      formatting support forweekday_indexed
      (class template specialization)[edit]
      hash support forstd::chrono::weekday_indexed
      (class template specialization)

      [edit]Example

      Run this code
      #include <chrono>#include <iostream> int main(){usingnamespace std::chrono; constexpr weekday_indexed wi= Friday[2]; // Indexed weekday can be used at any place where chrono::day can be used:constexpr year_month_weekday ymwd= 2021y/ August/ wi;    static_assert(ymwd== August/ wi/ 2021y&&                  ymwd== wi/ August/ 2021y);std::cout<< ymwd<<'\n'; constexpr year_month_day ymd{ymwd};// a conversion    static_assert(ymd== 2021y/8/13);std::cout<< ymd<<'\n';}

      Possible output:

      2021/Aug/Fri[2]2021-08-13
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/chrono/weekday_indexed&oldid=162972"

      [8]ページ先頭

      ©2009-2025 Movatter.jp