std::chrono...onth::month(3)
π NAME π
okay so bestie, this page is literally std::chrono::year_month::year,std::chrono::year_month::month β and the manual repeats it as std::chrono::year_month::year,std::chrono::year_month::month, because why not, iconic. It's page std::chrono...onth::month(3) from the C++ Standard Libary manual, and we're getting into it. π«Ά
β¨ Synopsis β¨
These are the two little accessor besties, both constexpr and both noexcept, both since C++20:
constexpr std::chrono::year year() const noexcept; (1) (since C++20)
constexpr std::chrono::month month() const noexcept; (2) (since C++20)
Retrieves the year and month values stored in this year_month object. slay. π
π Return value π
- Returns the stored
std::chrono::yearvalue. π - Returns the stored
std::chrono::monthvalue. πΈ
πΈ Example πΈ
// Run this code
#include <chrono>
#include <iostream>
int main()
{
std::cout << std::boolalpha;
constexpr auto ym{std::chrono::year(2021)/std::chrono::July};
std::cout << (ym.year() == std::chrono::year(2021)) << ' ';
std::cout << (ym.month() == std::chrono::month(7)) << '\n';
}
π¦ Output π¦
true true
mwah π this page is from http://cppreference.com, dated 2024.06.10, and it's the std::chrono...onth::month(3) page β bye bestie, go flex those chrono skills! πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms