std::chrono::duration<Rep,Period>::operator+(unary), (3) - Linux Manuals
std::chrono::duration<Rep,Period>::operator+(unary),: std::chrono::duration<Rep,Period>::operator+(unary),
Command to display std::chrono::duration<Rep,Period>::operator+(unary),
manual in Linux: $ man 3 std::chrono::duration<Rep,Period>::operator+(unary),
NAME
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> (since C++17)
operator+() const; (1)
constexpr duration operator-() const; (until C++17)
constexpr std::common_type_t<duration> (2) (since C++17)
operator-() const;
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
#include <chrono>
#include <iostream>
int main()
{
std::chrono::seconds s1(10);
std::chrono::seconds s2 = -s1;
std::cout << "negated 10 seconds are " << s2.count() << " seconds\n";
}
Output:
negated 10 seconds are -10 seconds
See also
operator++
operator++(int) increments or decrements the tick count
operator-- (public member function)
operator--(int)
operator+
operator- implements arithmetic operations with durations as arguments
operator* (function template)
operator/
operator%
Pages related to std::chrono::duration<Rep,Period>::operator+(unary),
- std::chrono::duration<Rep,Period>::operator+(unary),std::chrono::duration<Rep,Period>::operator-(unary) (3) - std::chrono::duration<Rep,Period>::operator+(unary),std::chrono::duration<Rep,Period>::operator-(unary)
- std::chrono::duration<Rep,Period>::operator++, (3) - std::chrono::duration<Rep,Period>::operator++,
- std::chrono::duration<Rep,Period>::operator++,std::chrono::duration<Rep,Period>::operator-- (3) - - std::chrono::duration<Rep,Period>::operator++,std::chrono::duration<Rep,Period>::operator--
- std::chrono::duration<Rep,Period>::operator= (3) - std::chrono::duration<Rep,Period>::operator=
- std::chrono::duration<Rep,Period>::count (3) - std::chrono::duration<Rep,Period>::count
- std::chrono::duration<Rep,Period>::duration (3) - std::chrono::duration<Rep,Period>::duration
- std::chrono::duration<Rep,Period>::max (3) - std::chrono::duration<Rep,Period>::max
- std::chrono::duration<Rep,Period>::min (3) - std::chrono::duration<Rep,Period>::min
- std::chrono::duration<Rep,Period>::zero (3) - std::chrono::duration<Rep,Period>::zero
- std::chrono::duration (3) - std::chrono::duration
- std::chrono::duration_cast (3) - std::chrono::duration_cast
- std::chrono::duration_values (3) - std::chrono::duration_values
- std::chrono::duration_values<Rep>::max (3) - std::chrono::duration_values<Rep>::max
- std::chrono::duration_values<Rep>::min (3) - std::chrono::duration_values<Rep>::min
- std::chrono::duration_values<Rep>::zero (3) - std::chrono::duration_values<Rep>::zero
- std::chrono::day (3) - std::chrono::day
- std::chrono::day::day (3) - std::chrono::day::day
- std::chrono::day::ok (3) - std::chrono::day::ok