mirror of https://github.com/CGAL/cgal
Merge pull request #8002 from afabri/CORE-zero_one-GF
Core: Use Expr::is_zero() of AST
This commit is contained in:
commit
217bfa30a5
|
|
@ -9,4 +9,5 @@ if(NOT CGAL_Core_FOUND)
|
|||
return()
|
||||
endif()
|
||||
|
||||
create_single_source_cgal_program("zero-one.cpp")
|
||||
create_single_source_cgal_program("delaunay.cpp")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
|
||||
typedef CORE::Expr Real;
|
||||
|
||||
int main()
|
||||
{
|
||||
Real r(3.14);
|
||||
|
||||
CGAL::is_zero(r);
|
||||
|
||||
CGAL::is_one(r);
|
||||
|
||||
r = CGAL::sqrt(r);
|
||||
|
||||
|
||||
CGAL::is_zero(r);
|
||||
|
||||
CGAL::is_one(r);
|
||||
|
||||
r = r * r;
|
||||
|
||||
CGAL::is_zero(r);
|
||||
|
||||
CGAL::is_one(r);
|
||||
|
||||
r = r - r;
|
||||
|
||||
CGAL::is_zero(r);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -115,6 +115,14 @@ template <> class Algebraic_structure_traits< CORE::Expr >
|
|||
}; */
|
||||
};
|
||||
|
||||
class Is_zero
|
||||
: public CGAL::cpp98::unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Type& x ) const {
|
||||
return x.isZero();
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
template <> class Real_embeddable_traits< CORE::Expr >
|
||||
|
|
|
|||
Loading…
Reference in New Issue