std:: ratio_not_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)
|
||||
|
ratio_not_equal
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
|
Défini dans l'en-tête
<ratio>
|
||
|
template
<
class
R1,
class
R2
>
struct ratio_not_equal : std:: integral_constant < bool , /* voir ci-dessous */ > { } ; |
(depuis C++11) | |
Si les rapports
R1
et
R2
ne sont pas égaux, fournit la constante membre
value
égale à
true
. Sinon,
value
est
false
.
Table des matières |
Modèle de variable d'assistance
|
template
<
class
R1,
class
R2
>
constexpr bool ratio_not_equal_v = ratio_not_equal < R1, R2 > :: value ; |
(depuis C++17) | |
Hérité de std:: integral_constant
Constantes membres
|
value
[static]
|
true
si
R1
::
num
!
=
R2
::
num
||
R1
::
den
!
=
R2
::
den
,
false
sinon
(constante membre publique statique) |
Fonctions membres
|
operator bool
|
convertit l'objet en
bool
, retourne
value
(fonction membre publique) |
|
operator()
(C++14)
|
retourne
value
(fonction membre publique) |
Types membres
| Type | Définition |
value_type
|
bool |
type
|
std:: integral_constant < bool , value > |
Implémentation possible
template< class R1, class R2 > struct ratio_not_equal : std::integral_constant < bool, !std::ratio_equal<R1, R2> > {}; |
Exemple
Exécuter ce code
#include <ratio> static_assert(std::ratio_not_equal_v<std::ratio<6, 9>, std::ratio<9, 6>>, "6/9 != 9/6"); int main() {}
Voir aussi
|
(C++11)
|
compare deux objets
ratio
pour l'égalité au moment de la compilation
(modèle de classe) |