Add unary operators + and - to year

This commit is contained in:
Howard Hinnant 2016-10-19 12:01:26 -04:00
parent 9e25c2d74f
commit 9f7a438f7d

5
date.h
View File

@ -318,6 +318,9 @@ public:
CONSTCD14 year& operator+=(const years& y) NOEXCEPT;
CONSTCD14 year& operator-=(const years& y) NOEXCEPT;
CONSTCD11 year operator-() const NOEXCEPT;
CONSTCD11 year operator+() const NOEXCEPT;
CONSTCD11 bool is_leap() const NOEXCEPT;
CONSTCD11 explicit operator int() const NOEXCEPT;
@ -1377,6 +1380,8 @@ CONSTCD14 inline year& year::operator--() NOEXCEPT {--y_; return *this;}
CONSTCD14 inline year year::operator--(int) NOEXCEPT {auto tmp(*this); --(*this); return tmp;}
CONSTCD14 inline year& year::operator+=(const years& y) NOEXCEPT {*this = *this + y; return *this;}
CONSTCD14 inline year& year::operator-=(const years& y) NOEXCEPT {*this = *this - y; return *this;}
CONSTCD11 inline year year::operator-() const NOEXCEPT {return year{-y_};}
CONSTCD11 inline year year::operator+() const NOEXCEPT {return *this;}
CONSTCD11
inline