std::chrono...onth::month(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– 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 πŸŽ€

  1. Returns the stored std::chrono::year value. πŸ’–
  2. Returns the stored std::chrono::month value. 🌸

🌸 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