std::chrono...ono::month)(3)
π NAME π
From the C++ Standard Libary manual (yes, that spelling is literally on the page, and I'm obsessed with the commitment π
), page std::chrono...ono::month)(3).
std::chrono::operator==,(std::chrono::month)β thestd::chrono::operator==,(std::chrono::month)page. We're comparing months, bestie. That comma is canon, no cap.
β¨ Synopsis β¨
Okay, synopsis time β exact code block, no edits:
Defined in header <chrono>
constexpr bool operator==( const std::chrono::month& x,
(1) (since C++20)
const std::chrono::month& y ) noexcept;
constexpr std::strong_ordering operator<=>( const
std::chrono::month& x,
(2) (since C++20)
const
std::chrono::month& y ) noexcept;
So we're comparing the two std::chrono::month values x and y. Both overloads are noexcept, and both are marked (since C++20). Pop off. π
Also, the <, <=, >, >=, and != operators are synthesized from operator<=> and operator== respectively. That's the C++20 spaceship pipeline, fr fr. π
πΈ Return value πΈ
unsigned(x) == unsigned(y)unsigned(x) <=> unsigned(y)
π Example π
// Run this code
#include <chrono>
int main()
{
constexpr std::chrono::month m1{6}, m2{8};
static_assert
(
m1 < m2 && m1 == m1 && m1 <= m2 &&
m2 > m1 && m2 != m1 && m2 >= m1 &&
m1 <=> m2 != 0
);
}
Mwah π this page is from http://cppreference.com, dated 2024.06.10, and it's the std::chrono...ono::month)(3) page. Byeee, go compare some months responsibly π«Άβ¨
π¦ 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