mirror of https://github.com/CGAL/cgal
Coercion_traits from Polynomial.h is now located in this separate file.
This commit is contained in:
parent
800ed22258
commit
4ac28b0e44
|
|
@ -1721,6 +1721,7 @@ Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_GetInnermostCoefficient.tex
|
|||
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_InnermostLeadingCoefficient.tex -text
|
||||
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_Move.tex -text
|
||||
Polynomial/doc_tex/Polynomial_ref/Polynomial_1.tex -text
|
||||
Polynomial/include/CGAL/Polynomial/Coercion_traits.h -text
|
||||
Polytope_distance_d/test/Polytope_distance_d/create_test_PD_cin -text
|
||||
Polytope_distance_d/test/Polytope_distance_d/test_PD.cin -text
|
||||
Polytope_distance_d/test/Polytope_distance_d/test_PD_data/intersecting_segments.data -text
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
// TODO: Add licence
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL:$
|
||||
// $Id:$
|
||||
//
|
||||
//
|
||||
// Author(s) :
|
||||
//
|
||||
// ============================================================================
|
||||
|
||||
// TODO: The comments are all original EXACUS comments and aren't adapted. So
|
||||
// they may be wrong now.
|
||||
|
||||
#ifndef CGAL_POLYNOMIAL_COERCION_TRAITS_H
|
||||
#define CGAL_POLYNOMIAL_COERCION_TRAITS_H
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
// COERCION_TRAITS BEGIN
|
||||
|
||||
//Coercion_traits_polynomial-----------------------------------
|
||||
// If there is a Polynomial_traits, valid for more than one Polynomial
|
||||
// class this part should be adapted, using a Polynomial_traits
|
||||
// and the nesting_depth
|
||||
template <class A,class B>
|
||||
class Coercion_traits_for_level<Polynomial<A>, Polynomial<B>, CTL_POLYNOMIAL >{
|
||||
typedef Coercion_traits<A,B> CT;
|
||||
public:
|
||||
typedef CGAL::Tag_true Are_explicit_interoperable;
|
||||
typedef CGAL::Tag_false Are_implicit_interoperable;
|
||||
typedef Polynomial<typename CT::Type> Type;
|
||||
struct Cast{
|
||||
typedef Type result_type;
|
||||
Type operator()(const Polynomial<A>& poly) const {
|
||||
typename CT::Cast cast;
|
||||
return Type(::boost::make_transform_iterator(poly.begin(),cast),
|
||||
::boost::make_transform_iterator(poly.end() ,cast));
|
||||
}
|
||||
Type operator()(const Polynomial<B>& poly) const {
|
||||
typename CT::Cast cast;
|
||||
return Type(::boost::make_transform_iterator(poly.begin(),cast),
|
||||
::boost::make_transform_iterator(poly.end() ,cast));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <class A,class B>
|
||||
class Coercion_traits_for_level<Polynomial<A>,B ,CTL_POLYNOMIAL >{
|
||||
typedef Coercion_traits<A,B> CT;
|
||||
public:
|
||||
typedef CGAL::Tag_true Are_explicit_interoperable;
|
||||
typedef CGAL::Tag_false Are_implicit_interoperable;
|
||||
|
||||
typedef Polynomial<typename CT::Type> Type;
|
||||
struct Cast{
|
||||
typedef Type result_type;
|
||||
Type operator()(const Polynomial<A>& poly) const {
|
||||
typename CT::Cast cast;
|
||||
return Type(::boost::make_transform_iterator(poly.begin(),cast),
|
||||
::boost::make_transform_iterator(poly.end() ,cast));
|
||||
}
|
||||
Type operator()(const B& x) const {
|
||||
typename CT::Cast cast;
|
||||
return Type(cast(x));
|
||||
}
|
||||
};
|
||||
};
|
||||
template <class A,class B>
|
||||
class Coercion_traits_for_level<B,Polynomial<A>,CTL_POLYNOMIAL >
|
||||
:public Coercion_traits_for_level<Polynomial<A>,B,CTL_POLYNOMIAL >
|
||||
{};
|
||||
|
||||
// COERCION_TRAITS END
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_POLYNOMIAL_COERCION_TRAITS_H
|
||||
Loading…
Reference in New Issue