[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/chrono/year/operator_cmp [Back]  [Original]

std::chrono::operator==,<=>(std::chrono::year) cppreference.com
cppreference.com

std::chrono::operator==,<=>(std::chrono::year)

cppreference.com
 
C++
(C++20)
(C++20)
(C++11)
(C++20)
/
(C++11)
(C++11)
(C++11)
(C++17)
 
 
(C++11)
(C++20)
(C++11)
(C++11)      
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)(C++20)
(C++20)

(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
/ chrono
(C++20)
C
 
 
<tbody> </tbody>
constexpr bool operator==( const std::chrono::year& x, const std::chrono::year& y ) noexcept;
(1) ( C++20)
constexpr std::strong_ordering operator<=>( const std::chrono::year& x, const std::chrono::year& y ) noexcept;
(2) ( C++20)

std::chrono::year x y.

<, <=, >, >= != operator<=> operator== .

1) int(x) == int(y)
2) int(x) <=> int(y)

#include <iostream>
#include <chrono>

int main()
{
    using namespace std::chrono;

    constexpr year y1{2020};
    constexpr year y2{2021};

    std::cout << std::boolalpha << (y1 != y2) << '\n';

    static_assert(
        (2020y < 2023y) && (2020y == 2020y) && (2020y <= 2023y) &&
        (2023y > 2020y) && (2023y != 2020y) && (2023y >= 2020y)
    );
}

:

true

Web Proxy Viewer  |  New URL  |  Original Page