#include <CGAL/Fraction_traits.h>
#include <CGAL/IO/io.h>
#ifdef CGAL_USE_GMP
int main(){
typedef FT::Numerator_type Numerator_type;
typedef FT::Denominator_type Denominator_type;
CGAL_static_assertion((std::is_same<Numerator_type,CGAL::Gmpz>::value));
CGAL_static_assertion((std::is_same<Denominator_type,CGAL::Gmpz>::value));
Numerator_type numerator;
Denominator_type denominator;
FT::Decompose()(fraction,numerator,denominator);
CGAL::IO::set_pretty_mode(std::cout);
std::cout << "decompose fraction: "<< std::endl;
std::cout << "fraction : " << fraction << std::endl;
std::cout << "numerator : " << numerator<< std::endl;
std::cout << "denominator: " << denominator << std::endl;
std::cout << "re-compose fraction: "<< std::endl;
fraction = FT::Compose()(numerator,denominator);
std::cout << "fraction : " << fraction << std::endl;
}
#else
int main(){ std::cout << "This examples needs GMP" << std::endl; }
#endif
An instance of Fraction_traits is a model of FractionTraits, where T is the associated type.
Definition: Fraction_traits.h:13