Namespaces
Variants

std::chrono::weekday_last:: weekday

From cppreference.net
constexpr std:: chrono :: weekday weekday ( ) const noexcept ;
(depuis C++20)

Récupère une copie de l'objet std::chrono::weekday stocké dans * this .

Valeur de retour

Une copie de l'objet std::chrono::weekday stocké dans * this .

Exemple

#include <chrono>
#include <iostream>
using namespace std::chrono;
int main()
{
    std::cout << std::boolalpha;
    auto wdl{Tuesday[last]}; // Dernier mardi du mois
    std::cout << (year_month_day{wdl/10/2019} ==
                  year_month_day{October/29/2019}) << ' ';
    wdl = {(wdl.weekday() + days(2))[last]}; // Le dernier mardi devient maintenant le dernier jeudi
    std::cout << (year_month_day{wdl/10/2019} ==
                  year_month_day{October/31/2019}) << '\n';
}

Sortie :

true true