std::chrono::year::operator+, std::chrono::year::operator-

Applies the unary operators to the year value.

# Declarations

constexpr std::chrono::year operator+() noexcept;

(since C++20)

constexpr std::chrono::year operator-() noexcept;

(since C++20)

# Example

#include <chrono>
#include <iostream>
 
int main()
{
    constexpr std::chrono::year y{2020};
    constexpr auto ny = -y;
    std::cout << "The year " << (int)y << " negated is " << (int)ny << '\n';
}