25 Time library [time]

25.8 The civil calendar [time.cal]

25.8.13 Class year_­month [time.cal.ym]

25.8.13.3 Non-member functions [time.cal.ym.nonmembers]

constexpr bool operator==(const year_month& x, const year_month& y) noexcept;
Returns: x.year() == y.year() && x.month() == y.month().
constexpr bool operator<(const year_month& x, const year_month& y) noexcept;
Returns: If x.year() < y.year() returns true.
Otherwise, if x.year() > y.year() returns false.
Otherwise, returns x.month() < y.month().
constexpr year_month operator+(const year_month& ym, const months& dm) noexcept;
Returns: A year_­month value z such that z - ym == dm.
Complexity: with respect to the value of dm.
constexpr year_month operator+(const months& dm, const year_month& ym) noexcept;
Returns: ym + dm.
constexpr year_month operator-(const year_month& ym, const months& dm) noexcept;
Returns: ym + -dm.
constexpr months operator-(const year_month& x, const year_month& y) noexcept;
Returns:
x.year() - y.year() + months{static_cast<int>(unsigned{x.month()}) -
                             static_cast<int>(unsigned{y.month()})}
constexpr year_month operator+(const year_month& ym, const years& dy) noexcept;
Returns: (ym.year() + dy) / ym.month().
constexpr year_month operator+(const years& dy, const year_month& ym) noexcept;
Returns: ym + dy.
constexpr year_month operator-(const year_month& ym, const years& dy) noexcept;
Returns: ym + -dy.
template<class charT, class traits> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const year_month& ym);
Returns: os << ym.year() << '/' << ym.month().
template<class charT, class traits> basic_ostream<charT, traits>& to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const year_month& ym);
Effects: Streams ym into os using the format specified by the NTCTS fmt.
fmt encoding follows the rules specified in [time.format].
Returns: os.
template<class charT, class traits, class Alloc = allocator<charT>> basic_istream<charT, traits>& from_stream(basic_istream<charT, traits>& is, const charT* fmt, year_month& ym, basic_string<charT, traits, Alloc>* abbrev = nullptr, minutes* offset = nullptr);
Effects: Attempts to parse the input stream is into the year_­month ym using the format flags given in the NTCTS fmt as specified in [time.parse].
If the parse fails to decode a valid year_­month, is.setstate(ios_­base​::​failbit) shall be called and ym shall not be modified.
If %Z is used and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null.
If %z (or a modified variant) is used and successfully parsed, that value will be assigned to *offset if offset is non-null.
Returns: is.