CGAL 5.1 - Number Types
CGAL::Rational_traits< NT > Class Template Reference

#include <CGAL/Rational_traits.h>

Definition

template<typename NT>
class CGAL::Rational_traits< NT >

The class Rational_traits can be used to determine the type of the numerator and denominator of a rational number type as Quotient, Gmpq, mpq_class or leda_rational.

Types

typedef unspecified_type RT
 the type of the numerator and denominator. More...
 

Operations

RT numerator (const NT &r) const
 returns the numerator of r. More...
 
RT denominator (const NT &r) const
 returns the denominator of r. More...
 
NT make_rational (const NT &x) const
 returns self. More...
 
NT make_rational (const std::pair< RT, RT > &p) const
 constructs a rational number p.first/p.second. More...
 
NT make_rational (const RT &n, const RT &d) const
 constructs a rational number. More...
 
NT make_rational (const NT &n, const NT &d) const
 constructs a rational number. More...
 

Member Typedef Documentation

◆ RT

template<typename NT >
typedef unspecified_type CGAL::Rational_traits< NT >::RT

the type of the numerator and denominator.

Member Function Documentation

◆ denominator()

template<typename NT >
RT CGAL::Rational_traits< NT >::denominator ( const NT &  r) const

returns the denominator of r.

◆ make_rational() [1/4]

template<typename NT >
NT CGAL::Rational_traits< NT >::make_rational ( const NT &  n,
const NT &  d 
) const

constructs a rational number.

◆ make_rational() [2/4]

template<typename NT >
NT CGAL::Rational_traits< NT >::make_rational ( const NT &  x) const

returns self.

◆ make_rational() [3/4]

template<typename NT >
NT CGAL::Rational_traits< NT >::make_rational ( const RT n,
const RT d 
) const

constructs a rational number.

◆ make_rational() [4/4]

template<typename NT >
NT CGAL::Rational_traits< NT >::make_rational ( const std::pair< RT, RT > &  p) const

constructs a rational number p.first/p.second.

◆ numerator()

template<typename NT >
RT CGAL::Rational_traits< NT >::numerator ( const NT &  r) const

returns the numerator of r.