A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/ratio/ratio_greater/ below:

class template

<ratio>

std::ratio_greater
template <class R1, class R2> ratio_greater;

Compare ratios for greater than inequality

This type inherits from the appropriate integral_constant type (either true_type or false_type) to signal whether R1 compares greater than to R2
The resulting type is the same as if ratio_less_equal was defined as:
1
2
template <class R1, class R2>
struct ratio_greater : integral_constant < bool, ratio_less<R2,R1>::value > {};

Template parameters
R1,R2
ratio types to be compared.

Member constants Inherited from integral_constant:
member constant definition value either true or false
Member types Inherited from integral_constant:

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

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

  std::cout << "1/3 > 1/2 ? " << std::boolalpha;
  std::cout << std::ratio_greater<one_third,one_half>::value << std::endl;

  return 0;
}

Output:


See also
ratio_less
Compare ratios for less-than inequality (class template)
ratio_equal
Compare ratios (class template)
ratio_greater_equal
Compare ratios for equality or greater-than inequality (class template)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4