std:: ratio_greater_equal
From cppreference.net
C++
Metaprogramming library
| Type traits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Compile-time rational arithmetic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Compile-time integer sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
(C++14)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Compile time rational arithmetic
|
(C++11)
|
||||
| Arithmetic | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Comparison | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
ratio_greater_equal
(C++11)
|
|
Definido en el encabezado
<ratio>
|
||
|
template
<
class
R1,
class
R2
>
struct ratio_greater_equal : std:: integral_constant < bool , /* ver más abajo */ > { } ; |
(desde C++11) | |
Si la razón
R1
es mayor o igual que la razón
R2
, proporciona la constante miembro
value
igual a
true
. De lo contrario,
value
es
false
.
Contenidos |
Plantilla de variable auxiliar
|
template
<
class
R1,
class
R2
>
constexpr bool ratio_greater_equal_v = ratio_greater_equal < R1, R2 > :: value ; |
(desde C++17) | |
Heredado de std:: integral_constant
Constantes miembro
|
value
[static]
|
true
si
R1
::
num
*
R2
::
den
>=
R2
::
num
*
R1
::
den
, o expresión equivalente que evita desbordamiento,
false
en caso contrario
(constante miembro pública estática) |
Funciones miembro
|
operator bool
|
convierte el objeto a
bool
, devuelve
value
(función miembro pública) |
|
operator()
(C++14)
|
devuelve
value
(función miembro pública) |
Tipos miembro
| Tipo | Definición |
value_type
|
bool |
type
|
std:: integral_constant < bool , value > |
Ejemplo
Ejecutar este código
#include <ratio> int main() { static_assert(std::ratio_greater_equal< std::ratio<2, 3>, std::ratio<2, 3>>::value, "2/3 >= 2/3"); // desde C++17 static_assert(std::ratio_greater_equal_v< std::ratio<999'998, 999'999>, std::ratio<999'997, 999'998>>); }
Véase también
|
(C++11)
|
compara dos objetos
ratio
para igualdad en tiempo de compilación
(plantilla de clase) |
|
(C++11)
|
compara dos objetos
ratio
para
menor que
en tiempo de compilación
(plantilla de clase) |