std::chrono::month_weekday_last:: month, std::chrono::month_weekday_last:: weekday_last
From cppreference.net
<
cpp
|
chrono
|
month weekday last
C++
Date and time library
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::chrono::month_weekday_last
| Member functions | ||||
|
month_weekday_last::month
month_weekday_last::weekday_last
|
||||
| Nonmember functions | ||||
| Helper classes | ||||
|
constexpr
std::
chrono
::
month
month
(
)
const
noexcept
;
|
(1) | (depuis C++20) |
|
constexpr
std::
chrono
::
weekday_last
weekday_last
(
)
const
noexcept
;
|
(2) | (depuis C++20) |
Récupère une copie des objets month et weekday_last stockés dans * this .
Valeur de retour
1)
Une copie de l'objet
std::chrono::month
stocké dans
*
this
.
2)
Une copie de l'objet
std::chrono::weekday_last
stocké dans
*
this
.
Exemple
Exécuter ce code
#include <chrono> #include <iostream> using namespace std::chrono; int main() { std::cout << std::boolalpha; auto mwdl{March/Friday[last]}; // Dernier vendredi d'un mars auto ywdl{year(2024)/mwdl}; std::cout << (year_month_day{ywdl} == year_month_day{March/29/2024}) << ' '; // Dernier vendredi du mois suivant, en 2024 mwdl = {(mwdl.month() + months(1))/mwdl.weekday_last()}; ywdl = {year(2024)/mwdl}; std::cout << (year_month_day{ywdl} == year_month_day{April/26/2024}) << '\n'; }
Sortie :
true true