operator+ Operator (STL)

Adds duration and time_point objects.

template<class Rep1, class Period1, class Rep2, class Period2>
   constexpr typename common_type<duration<Rep1, Period1>, 
      duration<Rep2, Period2> >::type
   operator+(const duration<Rep1, Period1>& Left,
      const duration<Rep2, Period2>& Right);
template<class Clock, class Duration1, class Rep2, class Period2>
   constexpr time_point<Clock, 
      typename common_type<Duration1, duration<Rep2, Period2> >::type>
   operator+(const time_point<Clock, Duration1>& Time,
      const duration<Rep2, Period2>& Dur);
template<class Rep1, class Period1, class Clock, class Duration2>
   time_point<Clock, 
      typename common_type<duration<Rep1, Period1>, Duration2>::type>
   operator+(const duration<Rep1, Period1>& Dur,
      const time_point<Clock, Duration2>& Time);

Parameters

  • Left
    The left duration or time_point object.

  • Right
    The right duration or time_point object.

  • Time
    A time_point object.

  • Dur
    A duration object.

Return Value

The first function returns a duration object that has a time interval that is equal to the sum of the intervals of Left and Right.

The second and third functions return a time_point object that represents a point in time that is displaced, by the interval Dur, from the point in time Time.

Requirements

Header: chrono

Namespace: std::chrono

See Also

Other Resources

Header Files