std::chrono::duration<Rep,Period>::operator+(unary),std::chrono::duration<Rep,Period>::operator-(unary) (3) - Linux Manuals
std::chrono::duration<Rep,Period>::operator+(unary),std::chrono::duration<Rep,Period>::operator-(unary): std::chrono::duration<Rep,Period>::operator+(unary),std::chrono::duration<Rep,Period>::operator-(unary)
NAME
std::chrono::duration<Rep,Period>::operator+(unary),std::chrono::duration<Rep,Period>::operator-(unary) - std::chrono::duration<Rep,Period>::operator+(unary),std::chrono::duration<Rep,Period>::operator-(unary)
Synopsis
constexpr duration operator+() const; (until C++17)
constexpr std::common_type_t<duration> operator+() const; (1) (since C++17)
constexpr duration operator-() const; (2) (until C++17)
constexpr std::common_type_t<duration> operator-() const; (since C++17)
Implements unary plus and unary minus for the durations.
If rep_ is a member variable holding the number of ticks in a duration object, and D is the return type,
1) Equivalent to return D(*this);
2) Equivalent to return D(-rep_);
Parameters
(none)
Return value
1) a copy of this duration object
2) a copy of this duration object, with the number of ticks negated
Example
// Run this code
Output:
See also
operator++ increments or decrements the tick count
operator++(int) (public member function)
operator--
operator--(int)
operator+
operator- implements arithmetic operations with durations as arguments
operator* (function template)
operator/
operator%