類模板
<ratio>

std::ratio_not_equal

template <class R1, class R2> ratio_not_equal;
比較 ratio 的不等性
此型別繼承自適當的 integral_constant 型別(true_typefalse_type)以指示 R1 是否與 R2 不相等。
結果型別與以下定義相同:ratio_not_equal定義為
1
2
template <class R1, class R2>
struct ratio_not_equal : integral_constant < bool, !ratio_equal<R1,R2>::value > {};

模板引數

R1,R2
要比較的 ratio 型別。

成員常量

繼承自 integral_constant
成員常量定義
truefalse

成員型別

繼承自 integral_constant
成員型別定義
value_typebool
型別true_type 或 false_type

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// ratio_not_equal example
#include <iostream>
#include <ratio>

int main ()
{
  typedef std::ratio<1,2> one_half;
  typedef std::ratio<2,4> two_fourths;

  std::cout << "1/2 != 2/4 ? " << std::boolalpha;
  std::cout << std::ratio_not_equal<one_half,two_fourths>::value << std::endl;

  return 0;
}

輸出
1/2 != 2/4 ? false


另見