\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.7 - Number Types
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::Number_type_checker< NT1, NT2, Comparator > Class Template Reference

#include <CGAL/Number_type_checker.h>

Definition

Number_type_checker is a number type whose instances store two numbers of types NT1 and NT2.

It forwards all arithmetic operations to them, and calls the binary predicate Comparator to check the equality of the instances after each modification, as well as for each comparison.

This is a debugging tool which is useful when dealing with number types.

Template Parameters
NT1,NT2must be a model of the same algebraic structure concept and they must be FromDoubleConstructible.
Comparatormust be a model of a binary predicate taking NT1 as first argument, and NT2 as second. The Comparator parameter has a default value which is a functor calling operator== between the two arguments.
Is Model Of:

IntegralDomainWithoutDivision (same as NT1)

RealEmbeddable

Operations

Some operations have a particular behavior documented here.

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &out, const Number_type_checker &c)
 writes c.n1() to the ostream out. More...
 
std::istream & operator>> (std::istream &in, Number_type_checker &c)
 reads an NT1 from in, then converts it to an NT2, so a conversion from NT1 to NT2 is required here. More...
 

Creation

 Number_type_checker ()
 introduces an uninitialized variable c. More...
 
 Number_type_checker (int i)
 introduces the integral value i. More...
 
 Number_type_checker (double d)
 introduces the floating point value d. More...
 
 Number_type_checker (const NT1 &n1, const NT2 &n2)
 introduces a variable storing the pair n1, n2. More...
 

Operations

const NT1 & n1 () const
 returns a const reference to the object of type NT1. More...
 
const NT2 & n2 () const
 returns a const reference to the object of type NT2. More...
 
NT1 & n1 ()
 returns a reference to the object of type NT1. More...
 
NT2 & n2 ()
 returns a reference to the object of type NT2. More...
 
bool is_valid () const
 calls the Comparator binary predicate on the two stored objects and returns its result. More...
 

Constructor & Destructor Documentation

template<typename NT1 , typename NT2 , typename Comparator >
CGAL::Number_type_checker< NT1, NT2, Comparator >::Number_type_checker ( )

introduces an uninitialized variable c.

template<typename NT1 , typename NT2 , typename Comparator >
CGAL::Number_type_checker< NT1, NT2, Comparator >::Number_type_checker ( int  i)

introduces the integral value i.

template<typename NT1 , typename NT2 , typename Comparator >
CGAL::Number_type_checker< NT1, NT2, Comparator >::Number_type_checker ( double  d)

introduces the floating point value d.

template<typename NT1 , typename NT2 , typename Comparator >
CGAL::Number_type_checker< NT1, NT2, Comparator >::Number_type_checker ( const NT1 &  n1,
const NT2 &  n2 
)

introduces a variable storing the pair n1, n2.

Member Function Documentation

template<typename NT1 , typename NT2 , typename Comparator >
bool CGAL::Number_type_checker< NT1, NT2, Comparator >::is_valid ( ) const

calls the Comparator binary predicate on the two stored objects and returns its result.

template<typename NT1 , typename NT2 , typename Comparator >
const NT1& CGAL::Number_type_checker< NT1, NT2, Comparator >::n1 ( ) const

returns a const reference to the object of type NT1.

template<typename NT1 , typename NT2 , typename Comparator >
NT1& CGAL::Number_type_checker< NT1, NT2, Comparator >::n1 ( )

returns a reference to the object of type NT1.

template<typename NT1 , typename NT2 , typename Comparator >
const NT2& CGAL::Number_type_checker< NT1, NT2, Comparator >::n2 ( ) const

returns a const reference to the object of type NT2.

template<typename NT1 , typename NT2 , typename Comparator >
NT2& CGAL::Number_type_checker< NT1, NT2, Comparator >::n2 ( )

returns a reference to the object of type NT2.

Friends And Related Function Documentation

template<typename NT1 , typename NT2 , typename Comparator >
std::ostream & operator<< ( std::ostream &  out,
const Number_type_checker< NT1, NT2, Comparator > &  c 
)
related

writes c.n1() to the ostream out.

template<typename NT1 , typename NT2 , typename Comparator >
std::istream & operator>> ( std::istream &  in,
Number_type_checker< NT1, NT2, Comparator > &  c 
)
related

reads an NT1 from in, then converts it to an NT2, so a conversion from NT1 to NT2 is required here.