operator==,!=,<,<=,>,>=,<=>(std::chrono::time_point)
De cppreference.com
<tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
| Definido en el archivo de encabezado <chrono>
|
||
| (1) | ||
template< class Clock, class Dur1, class Dur2 > bool operator==( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++11) (hasta C++14) |
|
template< class Clock, class Dur1, class Dur2 > constexpr bool operator==( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++14) | |
| (2) | ||
template< class Clock, class Dur1, class Dur2 > bool operator!=( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++11) (hasta C++14) |
|
template< class Clock, class Dur1, class Dur2 > constexpr bool operator!=( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++14) (hasta C++20) |
|
| (3) | ||
template< class Clock, class Dur1, class Dur2 > bool operator<( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++11) (hasta C++14) |
|
template< class Clock, class Dur1, class Dur2 > constexpr bool operator<( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++14) | |
| (4) | ||
template< class Clock, class Dur1, class Dur2 > bool operator<=( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++11) (hasta C++14) |
|
template< class Clock, class Dur1, class Dur2 > constexpr bool operator<=( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++14) | |
| (5) | ||
template< class Clock, class Dur1, class Dur2 > bool operator>( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++11) (hasta C++14) |
|
template< class Clock, class Dur1, class Dur2 > constexpr bool operator>( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++14) | |
| (6) | ||
template< class Clock, class Dur1, class Dur2 > bool operator>=( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++11) (hasta C++14) |
|
template< class Clock, class Dur1, class Dur2 > constexpr bool operator>=( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(desde C++14) | |
template<class Clock, class Dur1, std::three_way_comparable_with<Dur1> Dur2> constexpr auto operator<=>( const std::chrono::time_point<Clock,Dur1>& lhs, const std::chrono::time_point<Clock,Dur2>& rhs ); |
(7) | (desde C++20) |
Compara dos puntos de tiempo. La comparación se realiza comparando los resultados de time_since_epoch() para los puntos de tiempo.
1-2) Comprueba si los puntos de tiempo
lhs y rhs se refieren al mismo punto de tiempo para el reloj dado.3-6) Compara los puntos de tiempo
lhs y rhs.7) Compara los puntos de tiempo
lhs y rhs. El tipo de retorno se deduce de lhs.time_since_epoch() <=> rhs.time_since_epoch() y, por lo tanto, el tipo de resultado de la comparación de tres vías de Dur1 y Dur2.|
El operador |
(desde C++20) |
Parámetros
| lhs, rhs | - | Puntos de tiempo para comparar. |
Valor de retorno
1)
true si lhs y rhs se refieren al mismo punto de tiempo, false de lo contrario.2)
true si lhs y rhs se refieren puntos de tiempo distintos, false de lo contrario.3)
true si lhs se refiere al punto de tiempo antes de rhs, false de lo contrario.4)
true si lhs se refiere al punto de tiempo antes de rhs, o al mismo punto de tiempo que rhs, false de lo contrario.5)
true si lhs se refiere al punto de tiempo después de rhs, false de lo contrario.6)
true si lhs se refiere al punto de tiempo después de rhs, o al mismo punto de tiempo que rhs, false de lo contrario.7)
lhs.time_since_epoch() <=> rhs.time_since_epoch().Excepciones
Puede lanzar excepciones definidas por la implementación.
Notas
Los operadores de comparación de dos vías de time_point no eran constexpr en C++11. Esto se corrigió en C++14.