typedef long unsigned int size_t; namespace std { template struct pair { _T1 first; _T2 second; }; template inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y) { } void __throw_bad_alloc(void) __attribute__((__noreturn__)); template struct iterator_traits { typedef typename _Iterator::value_type value_type; }; template struct iterator_traits<_Tp*> { typedef _Tp value_type; typedef _Tp& reference; }; } namespace __gnu_cxx { using std::iterator_traits; template struct __normal_iterator { _Iterator _M_current; typedef iterator_traits<_Iterator> __traits_type; typedef typename __traits_type::value_type value_type; typedef typename __traits_type::reference reference; __normal_iterator() { } explicit __normal_iterator(const _Iterator& __i) : _M_current(__i) { } reference operator*() const { return *_M_current; } void operator++() { } void operator++(int) { } }; template inline bool operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { } template class new_allocator { public: typedef size_t size_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef const _Tp& const_reference; pointer allocate(size_type __n, const void* = 0) { if (__n > this->max_size()) std::__throw_bad_alloc(); } size_type max_size() const throw() { } }; } namespace std { template class allocator: public __gnu_cxx::new_allocator<_Tp> { public: typedef size_t size_type; template struct rebind { typedef allocator<_Tp1> other; }; }; template struct unary_function { typedef _Result result_type; }; template struct binary_function { typedef _Result result_type; }; } namespace CGAL { void precondition_fail ( const char*, const char*, int, const char* = "") __attribute__ ((__noreturn__)); void postcondition_fail ( const char*, const char*, int, const char* = "") __attribute__ ((__noreturn__)); inline bool possibly(bool b); template struct Boolean_tag { }; typedef Boolean_tag Tag_true; typedef Boolean_tag Tag_false; struct Null_tag { }; } namespace mpl_ { } namespace boost { namespace mpl { using namespace mpl_; template< bool C , typename T1 , typename T2 > struct if_c { typedef T2 type; }; } } namespace mpl_ { template< bool C_ > struct bool_; typedef bool_ true_; typedef bool_ false_; template< bool C_ > struct bool_ { static const bool value = C_; typedef bool_ type; }; template< typename T, T N > struct integral_c; struct na { }; } namespace boost{ template struct integral_constant : public mpl::integral_c { }; template<> struct integral_constant : public mpl::false_ { }; template< typename T, typename U > struct is_same : ::boost::integral_constant { }; } namespace CGAL { template < typename A, typename B, int = 0 > struct First_if_different { struct Type{ }; }; extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) throw () __attribute__ ((__noreturn__)); } namespace boost { namespace mpl { template< typename T1 = na , typename T2 = na , typename T3 = false_, typename T4 = false_, typename T5 = false_ > struct or_ : true_ { }; } } namespace CGAL { template struct Coercion_traits; template struct Coercion_traits{ typedef A Type; struct Cast{ Type inline operator()(const A& x) const { return x; } }; }; enum COERCION_TRAITS_LEVEL { CTL_TOP = 4, CTL_POLYNOMIAL = 4, CTL_COMPLEX = 3, CTL_INTERVAL = 2, CTL_SQRT_EXT = 1 }; template struct Coercion_traits_for_level: public Coercion_traits_for_level{ }; template struct Coercion_traits :public Coercion_traits_for_level{ }; } namespace boost { namespace detail { template class empty_base { }; template struct is_base_and_derived_impl { }; } template< typename Base, typename Derived > struct is_base_and_derived : ::boost::integral_constant::value)> { }; } namespace CGAL { template< class Base, class Derived > struct is_same_or_derived : public ::boost::mpl::or_< ::boost::is_same< Base, Derived >, ::boost::is_base_and_derived< Base, Derived > >::type { }; struct Integral_domain_without_division_tag { }; struct Integral_domain_tag : public Integral_domain_without_division_tag { }; struct Unique_factorization_domain_tag : public Integral_domain_tag { }; struct Euclidean_ring_tag : public Unique_factorization_domain_tag { }; template< class Type_ > class Algebraic_structure_traits { }; template< class Type, class Algebra_type > class Algebraic_structure_traits_base; template< class Type_ > class Algebraic_structure_traits_base< Type_, Null_tag > { }; template< class Type_ > class Algebraic_structure_traits_base< Type_, Integral_domain_without_division_tag > : public Algebraic_structure_traits_base< Type_, Null_tag > { public: typedef Type_ Type; class Unit_part : public std::unary_function< Type, Type > { public: Type operator()( const Type& x ) const { return( x < Type(0)) ? Type(-1) : Type(1); } }; class Is_zero : public std::unary_function< Type, bool > { }; class Is_one : public std::unary_function< Type, bool > { }; }; template< class Type_ > class Algebraic_structure_traits_base< Type_, Integral_domain_tag > : public Algebraic_structure_traits_base< Type_, Integral_domain_without_division_tag > { }; template< class Type_ > class Algebraic_structure_traits_base< Type_, Unique_factorization_domain_tag > : public Algebraic_structure_traits_base< Type_, Integral_domain_tag > { }; template< class Type_ > class Algebraic_structure_traits_base< Type_, Euclidean_ring_tag > : public Algebraic_structure_traits_base< Type_, Unique_factorization_domain_tag > { public: typedef Type_ Type; typedef Euclidean_ring_tag Algebraic_category; class Integral_division : public std::binary_function< Type, Type, Type > { public: Type operator()( const Type& x, const Type& y) const { typedef Algebraic_structure_traits AST; typename AST::Div actual_div; (CGAL::possibly( actual_div( x, y) * y == x)?(static_cast(0)): ::CGAL::precondition_fail( "x" , "h", 268, "")); } }; class Gcd : public std::binary_function< Type, Type, Type > { public: Type operator()( const Type& x, const Type& y) const { typedef Algebraic_structure_traits AST; typename AST::Unit_part unit_part; typename AST::Integral_division integral_div; if (x == Type(0)) { if (y == Type(0)) return Type(0); return integral_div( y, unit_part(y) ); } if (y == Type(0)) return integral_div(x, unit_part(x) ); Type u = integral_div( x, unit_part(x) ); Type v = integral_div( y, unit_part(y) ); Type w; while (v != Type(0)); } }; class Div_mod { public: typedef Type first_argument_type; void operator()( const Type& x, const Type& y, Type& q, Type& r) const { typedef Algebraic_structure_traits Traits; typename Traits::Div actual_div; q = actual_div( x, y ); } }; class Div : public std::binary_function< Type, Type, Type > { public: Type operator()( const Type& x, const Type& y) const { typename Algebraic_structure_traits ::Div_mod actual_div_mod; Type q; Type r; actual_div_mod( x, y, q, r ); }; }; }; template< class AS > inline typename Algebraic_structure_traits::Is_one::result_type is_one( const AS& x ) { } template< class A, class B > inline typename Algebraic_structure_traits< typename Coercion_traits::Type> ::Integral_division::result_type integral_division( const A& x, const B& y ) { } template< class A, class B > inline typename Algebraic_structure_traits< typename Coercion_traits::Type > ::Gcd::result_type gcd( const A& x, const B& y ) { } template< class Number_type > inline typename Algebraic_structure_traits< Number_type >::Is_zero::result_type is_zero( const Number_type& x ) { } } namespace boost { template > struct less_than_comparable2 : B { }; template > struct less_than_comparable1 : B { }; template > struct equality_comparable2 : B { }; template > struct equality_comparable1 : B { friend bool operator!=(const T& x, const T& y) { } }; template > struct multipliable2 : B { }; template > struct multipliable1 : B { friend T operator *( const T& lhs, const T& rhs ) { } }; template > struct addable2 : B { }; template > struct addable1 : B { friend T operator +( const T& lhs, const T& rhs ) { } }; template > struct subtractable2 : B { }; template > struct subtractable2_left : B { }; template > struct subtractable1 : B { }; template > struct dividable2 : B { }; template > struct dividable2_left : B { }; template > struct dividable1 : B { }; template > struct totally_ordered2 : less_than_comparable2 > { }; template > struct totally_ordered1 : less_than_comparable1 > { }; template > struct additive2 : addable2 > { }; template > struct additive1 : addable1 > { }; template > struct ring_operators2 : additive2 > > { }; template > struct ring_operators1 : additive1 > { }; template > struct field_operators2 : ring_operators2 > > { }; template > struct field_operators1 : ring_operators1 > { }; template > struct ordered_field_operators2 : field_operators2 > { }; template > struct ordered_field_operators1 : field_operators1 > { }; } namespace std { template struct _Vector_base { typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type; struct _Vector_impl : public _Tp_alloc_type { typename _Tp_alloc_type::pointer _M_start; typename _Tp_alloc_type::pointer _M_finish; typename _Tp_alloc_type::pointer _M_end_of_storage; _Vector_impl(_Tp_alloc_type const& __a) : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) { } }; public: typedef _Alloc allocator_type; _Vector_base(size_t __n, const allocator_type& __a) : _M_impl(__a) { this->_M_impl._M_start = this->_M_allocate(__n); } public: _Vector_impl _M_impl; typename _Tp_alloc_type::pointer _M_allocate(size_t __n) { return __n != 0 ? _M_impl.allocate(__n) : 0; } }; template > class vector : protected _Vector_base<_Tp, _Alloc> { typedef _Vector_base<_Tp, _Alloc> _Base; typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; public: typedef _Tp value_type; typedef typename _Tp_alloc_type::const_pointer const_pointer; typedef typename _Tp_alloc_type::const_reference const_reference; typedef __gnu_cxx::__normal_iterator const_iterator; typedef size_t size_type; typedef _Alloc allocator_type; explicit vector(size_type __n, const value_type& __value = value_type(), const allocator_type& __a = allocator_type()) : _Base(__n, __a) { } const_iterator begin() const { return const_iterator(this->_M_impl._M_start); } const_iterator end() const { } size_type size() const { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); } const_reference operator[](size_type __n) const { } const_reference back() const { } void pop_back() { } }; } typedef struct { } __mpz_struct; typedef __mpz_struct mpz_t[1]; typedef __mpz_struct *mpz_ptr; extern "C" { void __gmpz_init_set_si (mpz_ptr, signed long int); } namespace CGAL{ template class Polynomial; namespace internal{ template inline Polynomial gcd_(const Polynomial&, const Polynomial&); template inline Polynomial gcd_utcf_(const Polynomial&, const Polynomial&); template inline bool may_have_common_factor(const Polynomial&,const Polynomial&); } template class Reference_counted { public: typedef T_ rep_type; typedef rep_type* Rep_pointer; private: mutable unsigned int count; rep_type rep; public: Reference_counted() : count(1) { } Reference_counted( const rep_type& t) : count(1), rep(t) { } Rep_pointer base_ptr() { return &rep; } bool is_shared() const { return count > 1; } }; struct Reference_counted_hierarchy_base { }; namespace Intern { template struct Rep_bind_reference_counted { typedef Reference_counted Rep; }; } class Handle_policy_no_union { public: template struct Rep_bind { typedef typename Intern::Rep_bind_reference_counted::Rep Rep; }; template static typename H::Rep_pointer find( const H& h) { return h.ptr_->base_ptr(); } }; template > class Handle_with_policy { public: typedef T_ Handled_type; typedef HandlePolicy Handle_policy; enum { is_class_hierarchy = ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type>::value }; typedef typename Handle_policy::template Rep_bind< Handled_type, is_class_hierarchy > Bind; typedef typename ::boost::mpl::if_c< is_class_hierarchy, ::CGAL::Tag_true, ::CGAL::Tag_false >::type Class_hierarchy; typedef typename Bind::Rep Rep; typedef typename Rep::Rep_pointer Rep_pointer; typedef typename Allocator_::template rebind::other Rep_allocator; friend class Handle_policy_no_union; private: mutable Rep* ptr_; static Rep_allocator allocator; static Rep* new_rep( const Rep& rep) { Rep* p = allocator.allocate(1); } template Rep* make_from_single_arg( const TT& t, ::CGAL::Tag_false ) { return new_rep( Rep( Handled_type(t))); } protected: Handled_type* ptr() { } const Handled_type* ptr() const { return static_cast(Handle_policy::find( *this)); } template explicit Handle_with_policy( const T1& t) : ptr_( make_from_single_arg( t, Class_hierarchy())) { } bool is_shared() const { return ptr_->is_shared(); } }; template < class I, class P > struct Filter_iterator { typedef I Iterator; typedef P Predicate; protected: Iterator e_; Iterator c_; Predicate p_; public: Filter_iterator() { } Filter_iterator(Iterator e, const Predicate& p, Iterator c) : e_(e), c_(c), p_(p) { while (c_ != e_ && p_(c_)) ++c_; } }; template struct Nested_iterator_traits { }; namespace internal { template struct Emptyness_predicate : public Tr { typedef Tr Traits; bool operator()(typename Traits::Base_iterator base_it) const { } }; template class FI_w_begin_end : public F_iterator { private: typedef typename F_iterator::Predicate Predicate; typedef typename Predicate::Traits::Base_iterator Base_iterator; public: FI_w_begin_end() : F_iterator() { } FI_w_begin_end(Base_iterator it2, Base_iterator it3) : F_iterator(it2, Predicate(), it3) { } }; } template > struct Nested_iterator : private internal::FI_w_begin_end< Filter_iterator > > { typedef Nested_iterator Self; typedef Base_it Base_iterator; typedef typename Tr::Iterator Iterator; typedef internal:: FI_w_begin_end< Filter_iterator > > Filter_base_iterator; Nested_iterator() : Filter_base_iterator(), nested_it_() { } Nested_iterator(Base_iterator base_it_end, Base_iterator base_it_cur) : Filter_base_iterator(base_it_end, base_it_cur), nested_it_() { } Self operator++(int) { } Iterator nested_it_; }; template inline bool operator!=(const Nested_iterator& it1, const Nested_iterator& it2) { } template class Recursive_const_flattening; template class Recursive_const_flattening<0, InputIterator> { public: typedef Recursive_const_flattening Self; typedef InputIterator Input_iterator; typedef Input_iterator Recursive_flattening_iterator; struct Flatten { Recursive_flattening_iterator operator () (Input_iterator , Input_iterator it) { } }; }; template< int level_, class InputIterator > struct Recursive_const_flattening { static const int level = level_; typedef InputIterator Input_iterator; typedef Recursive_const_flattening< level-1, typename std::iterator_traits::value_type::const_iterator > Nested_self; struct Nested_iterator_traits { typedef Input_iterator Base_iterator; typedef typename Nested_self::Recursive_flattening_iterator Iterator; }; typedef CGAL::Nested_iterator< Input_iterator, Nested_iterator_traits > Recursive_flattening_iterator; struct Flatten { Recursive_flattening_iterator operator () (Input_iterator end,Input_iterator it) { return Recursive_flattening_iterator(end,it); } }; }; namespace internal{ template struct Innermost_coefficient_type{ typedef T Type; }; template struct Innermost_coefficient_type >{ typedef typename Innermost_coefficient_type::Type Type; }; template struct Dimension{ static const int value = 0; }; template struct Dimension > { static const int value = Dimension::value + 1 ; }; class Creation_tag { }; template class Polynomial_rep { typedef NT_ NT; typedef std::vector Vector; typedef typename Vector::size_type size_type; typedef typename Vector::const_iterator const_iterator; Vector coeff; Polynomial_rep(Creation_tag, size_type s) : coeff(s,NT(0)) { } void reduce() { while ( coeff.size()>1 && CGAL::is_zero(coeff.back())) coeff.pop_back(); } friend class Polynomial; }; } template struct Polynomial : public Handle_with_policy< internal::Polynomial_rep >, public boost::ordered_field_operators1< Polynomial , boost::ordered_field_operators2< Polynomial , NT_ , boost::ordered_field_operators2< Polynomial , typename CGAL::First_if_different< typename CGAL::internal::Innermost_coefficient_type::Type, NT_, 1>::Type, boost::ordered_field_operators2< Polynomial , typename CGAL::First_if_different< int, typename CGAL::internal::Innermost_coefficient_type::Type , 2>::Type > > > > { typedef NT_ NT; typedef internal::Polynomial_rep Rep; typedef Handle_with_policy< Rep > Base; typedef typename Rep::const_iterator const_iterator; typedef Polynomial Self; NT& coeff(unsigned int i) { CGAL::possibly(!this->is_shared() && i<(this->ptr()->coeff.size()))?(static_cast(0)): ::CGAL::precondition_fail( "a" , "b", 243); } void reduce() { this->ptr()->reduce(); } static Self& get_default_instance(){ } Polynomial(const Self& p = get_default_instance()) : Base(static_cast(p)) { } template explicit Polynomial(const T& a0) : Base(Rep(internal::Creation_tag(), 1)) { coeff(0) = NT(a0); reduce(); } const_iterator begin() const { } const_iterator end() const { } int degree() const { return static_cast(this->ptr()->coeff.size())-1; } bool is_zero() const { return degree()==0 && this->ptr()->coeff[0]==NT(0); } NT content() const { return content_( typename Algebraic_structure_traits< NT >::Algebraic_category() ); } NT content_( Unique_factorization_domain_tag ) const { typename Algebraic_structure_traits::Integral_division idiv; typename Algebraic_structure_traits::Unit_part upart; typename Algebraic_structure_traits::Gcd gcd; const_iterator it = this->ptr()->coeff.begin(), ite = this->ptr()->coeff.end(); NT d = idiv(*it, upart(*it)); for( ; it != ite; it++) { if (d == NT(1)) return d; if (*it != NT(0)) d = gcd(d, *it); } } NT unit_part() const { } static void pseudo_division(const Polynomial& f, const Polynomial& g, Polynomial& q, Polynomial& r, NT& D); }; template inline bool operator == (const Polynomial& p1, const Polynomial& p2) { } template void Polynomial::pseudo_division( const Polynomial& A, const Polynomial& B, Polynomial& Q, Polynomial& R, NT& D) { int delta = A.degree() - B.degree(); if (delta < 0 || A.is_zero()) { CGAL::possibly(Polynomial(D)*A == Q*B + R)?(static_cast(0)): ::CGAL::postcondition_fail( "R" , "h", 1150); } CGAL::possibly(Polynomial(D)*A == Q*B + R)?(static_cast(0)): ::CGAL::postcondition_fail( "R" , "h", 1177); } template class Polynomial_traits_d; template< class POLY, class Algebraic_type > class Polynomial_algebraic_structure_traits_base; template< class POLY > class Polynomial_algebraic_structure_traits_base< POLY, Integral_domain_without_division_tag > : public Algebraic_structure_traits_base< POLY, Integral_domain_without_division_tag > { public: typedef Integral_domain_without_division_tag Algebraic_category; struct Unit_part : public std::unary_function< POLY, POLY > { POLY operator()( const POLY& x ) const { return POLY( x.unit_part() ); } }; }; template< class POLY > class Polynomial_algebraic_structure_traits_base< POLY, Integral_domain_tag > : public Polynomial_algebraic_structure_traits_base< POLY, Integral_domain_without_division_tag > { public: typedef Integral_domain_tag Algebraic_category; struct Integral_division : public std::binary_function< POLY, POLY, POLY > { POLY operator()( const POLY& x, const POLY& y ) const { } }; }; template< class POLY > class Polynomial_algebraic_structure_traits_base< POLY, Unique_factorization_domain_tag > : public Polynomial_algebraic_structure_traits_base< POLY, Integral_domain_tag > { public: typedef Unique_factorization_domain_tag Algebraic_category; struct Gcd : public std::binary_function< POLY, POLY, POLY > { typedef typename Polynomial_traits_d::Multivariate_content Mcontent; typedef typename Mcontent::result_type ICoeff; ICoeff gcd_help(const ICoeff& x, const ICoeff& y, Unique_factorization_domain_tag) const { } POLY operator()( const POLY& x, const POLY& y ) const { typedef Algebraic_structure_traits AST; typename AST::Integral_division idiv; typename AST::Unit_part upart; if (CGAL::is_zero(x)) { return idiv(y,upart(y)); } if (CGAL::is_zero(y)) return idiv(x,upart(x)); if (internal::may_have_common_factor(x,y)) return CGAL::internal::gcd_(x,y); else{ typename Algebraic_structure_traits::Algebraic_category category; return POLY(gcd_help(Mcontent()(x),Mcontent()(y), category)); } } template < class CT_Type_1, class CT_Type_2 > POLY operator()( const CT_Type_1& x, const CT_Type_2& y ) const { typename Coercion_traits< CT_Type_1, CT_Type_2 >::Cast cast; return operator()( cast(x), cast(y) ); } }; }; template< class POLY > class Polynomial_algebraic_structure_traits_base< POLY, Euclidean_ring_tag > : public Polynomial_algebraic_structure_traits_base< POLY, Unique_factorization_domain_tag > { }; template< class NT > class Algebraic_structure_traits< Polynomial< NT > > : public Polynomial_algebraic_structure_traits_base< Polynomial< NT >, typename Algebraic_structure_traits< NT >::Algebraic_category > { }; namespace internal{ template struct Coercion_traits_for_polynomial_comp_d :public Coercion_traits_for_polynomial_comp_d< B, A , false >{ }; template struct Coercion_traits_for_polynomial_comp_d< Polynomial, B , false>{ typedef Coercion_traits CT; typedef Polynomial Type; struct Cast{ Type operator()(const Polynomial& poly) const { } Type operator()(const B& x) const { typename CT::Cast cast; return Type(cast(x)); } }; }; template struct Coercion_traits_for_polynomial : public Coercion_traits_for_polynomial_comp_d < A , B , Dimension::value < Dimension::value >{ }; } template struct Coercion_traits_for_level< Polynomial , B , CTL_POLYNOMIAL > :public internal::Coercion_traits_for_polynomial< Polynomial, B > { }; namespace internal { template inline Polynomial gcd_utcf_UFD( Polynomial p1, Polynomial p2 ) { NT p1c = p1.content(), p2c = p2.content(); NT gcdcont = CGAL::gcd(p1c,p2c); NT dummy; Polynomial q, r; NT g = NT(1), h = NT(1); for (; ; ) { Polynomial::pseudo_division(p1, p2, q, r, dummy); if (r.is_zero()) { break; } if (r.degree() == 0) { (Polynomial(gcdcont)); } } } template inline Polynomial gcd_( const Polynomial& p1, const Polynomial& p2, Unique_factorization_domain_tag) { typedef Polynomial POLY; typedef Polynomial_traits_d PT; typedef typename PT::Innermost_coefficient_type IC; typename PT::Multivariate_content mcont; IC mcont_p1 = mcont(p1); IC mcont_p2 = mcont(p2); typename CGAL::Coercion_traits::Cast ictp; POLY p1_ = CGAL::integral_division(p1,ictp(mcont_p1)); POLY p2_ = CGAL::integral_division(p2,ictp(mcont_p2)); return CGAL::internal::gcd_utcf_(p1_, p2_) * ictp(CGAL::gcd(mcont_p1, mcont_p2)); } template inline Polynomial gcd_(const Polynomial& p1, const Polynomial& p2) { typedef typename internal::Innermost_coefficient_type >::Type IC; typedef typename Algebraic_structure_traits::Algebraic_category Algebraic_category; return internal::gcd_(p1,p2,Algebraic_category()); } template Polynomial inline gcd_utcf_(const Polynomial& p1, const Polynomial& p2){ return internal::gcd_utcf_UFD(p1, p2); } template< class Coefficient_type_, class ICoeffAlgebraicCategory > class Polynomial_traits_d_base_icoeff_algebraic_category { }; template< class Coefficient_type_ > struct Polynomial_traits_d_base_icoeff_algebraic_category< Polynomial< Coefficient_type_ >, Unique_factorization_domain_tag > : public Polynomial_traits_d_base_icoeff_algebraic_category< Polynomial< Coefficient_type_ >, Integral_domain_tag > { typedef Polynomial_traits_d< Polynomial< Coefficient_type_ > > PT; typedef Polynomial Polynomial_d; typedef Coefficient_type_ Coefficient_type; typedef typename Innermost_coefficient_type::Type Innermost_coefficient_type; static const int d = Dimension::value; typedef CGAL::Recursive_const_flattening< d-1, typename CGAL::Polynomial::const_iterator > Coefficient_const_flattening; typedef typename Coefficient_const_flattening::Recursive_flattening_iterator Innermost_coefficient_const_iterator; struct Multivariate_content : public std::unary_function< Polynomial_d , Innermost_coefficient_type >{ Innermost_coefficient_type operator()(const Polynomial_d& p) const { typedef Innermost_coefficient_const_iterator IT; Innermost_coefficient_type content(0); typename PT::Construct_innermost_coefficient_const_iterator_range range; for (IT it = range(p).first; it != range(p).second; it++){ if(CGAL::is_one(content)) break; } } }; }; template< class Coefficient_type_ > class Polynomial_traits_d_base_icoeff_algebraic_category< Polynomial< Coefficient_type_ >, Euclidean_ring_tag > : public Polynomial_traits_d_base_icoeff_algebraic_category< Polynomial< Coefficient_type_ >, Unique_factorization_domain_tag > { }; template< class InnermostCoefficient_type, class ICoeffAlgebraicCategory, class PolynomialAlgebraicCategory > class Polynomial_traits_d_base { }; template< class Coefficient_type_, class ICoeffAlgebraicCategory, class PolynomialAlgebraicCategory > struct Polynomial_traits_d_base< Polynomial< Coefficient_type_ >, ICoeffAlgebraicCategory, PolynomialAlgebraicCategory > : public Polynomial_traits_d_base_icoeff_algebraic_category< Polynomial< Coefficient_type_ >, ICoeffAlgebraicCategory > { typedef Polynomial Polynomial_d; typedef Coefficient_type_ Coefficient_type; static const int d = Dimension::value; typedef CGAL::Recursive_const_flattening< d-1, typename CGAL::Polynomial::const_iterator > Coefficient_const_flattening; typedef typename Coefficient_const_flattening::Recursive_flattening_iterator Innermost_coefficient_const_iterator; typedef std::pair Innermost_coefficient_const_iterator_range; struct Construct_innermost_coefficient_const_iterator_range : public std::unary_function< Polynomial_d, Innermost_coefficient_const_iterator_range> { Innermost_coefficient_const_iterator_range operator () (const Polynomial_d& p) const { return std::make_pair( typename Coefficient_const_flattening::Flatten()(p.end(),p.begin()), typename Coefficient_const_flattening::Flatten()(p.end(),p.end())); } }; }; } template< class Polynomial > struct Polynomial_traits_d : public internal::Polynomial_traits_d_base< Polynomial, typename Algebraic_structure_traits< typename internal::Innermost_coefficient_type::Type >::Algebraic_category, typename Algebraic_structure_traits< Polynomial >::Algebraic_category > { }; } namespace CORE { template struct RCImpl { RCImpl(T* p) : rep(p) { } T* rep; }; struct BigIntRep { BigIntRep() : refCount(1) { } BigIntRep(signed int i) { __gmpz_init_set_si(mp, i); } mpz_t mp; int refCount; }; struct BigInt { public: BigInt() : RCBigInt(new BigIntRep()) { } BigInt(signed int x) : RCBigInt(new BigIntRep(x)) { } BigIntRep* RCBigInt; }; inline BigInt operator*(const BigInt& a, const BigInt& b) { } inline bool operator==(const BigInt& a, const BigInt& b) { } struct BigFloatRep { BigFloatRep(); }; typedef RCImpl RCBigFloat; struct BigFloat : public RCBigFloat { BigFloat(const BigInt& I) : RCBigFloat(new BigFloatRep()) { } }; inline bool operator< (const BigFloat& x, const BigFloat& y) { } struct Real { Real(const BigInt& I) ; }; inline bool operator!=(const Real& x, const Real& y) { } } namespace CGAL { template <> class Algebraic_structure_traits< CORE::BigInt > : public Algebraic_structure_traits_base< CORE::BigInt, Euclidean_ring_tag > { }; template struct Polynomial_type_generator { private: typedef typename Polynomial_type_generator::Type Coeff; public: typedef CGAL::Polynomial Type; }; template struct Polynomial_type_generator{ typedef T Type; }; namespace INTERN_COERCION_TRAITS { template< class A, class B, class Type, class Gcd > struct Test_gcd { void operator()() { Gcd gcd; A a(4); B b(2); typename CGAL::Coercion_traits< A, B >::Cast cast; Type a_ret = cast(a); Type b_ret = cast(b); (gcd( a, b ) == ::CGAL:: gcd( a_ret, b_ret )) ? static_cast (0) : __assert_fail ("a", "b", 197, "c"); } }; template void test_explicit_interoperable_one_way(){ typedef typename CGAL::Coercion_traits::Type Type; typedef typename CGAL::Algebraic_structure_traits::Gcd Gcd; Test_gcd< A, B, Type, Gcd >()(); } } template void test_explicit_interoperable(){ INTERN_COERCION_TRAITS::test_explicit_interoperable_one_way(); } } template void test_coercion_from_to(A, B){ CGAL::test_explicit_interoperable(); } void test_coercion_traits(){ typedef CORE::BigInt Integer; typedef typename CGAL::Polynomial_type_generator::Type POLY_INT_2; typedef typename CGAL::Polynomial_type_generator::Type POLY_INT_3; test_coercion_from_to(POLY_INT_2(), POLY_INT_3()); }