mirror of https://github.com/CGAL/cgal
Fix ambiguities in constructors of PointH?,
as convertibility between RT<->FT<->int was a problem. Use enable_if<> and is_convertible<> for this.
This commit is contained in:
parent
d8ff0f334c
commit
c206dcd8e1
|
|
@ -28,6 +28,8 @@
|
|||
#include <CGAL/Bbox_2.h>
|
||||
#include <CGAL/Threetuple.h>
|
||||
#include <CGAL/Kernel/Cartesian_coordinate_iterator_2.h>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -58,12 +60,12 @@ public:
|
|||
PointH2(const Origin &)
|
||||
: base (RT(0), RT(0), RT(1)) {}
|
||||
|
||||
PointH2(int x, int y)
|
||||
template < typename Tx, typename Ty >
|
||||
PointH2(const Tx & x, const Ty & y,
|
||||
typename boost::enable_if_c<boost::is_convertible<Tx, RT>::value &&
|
||||
boost::is_convertible<Ty, RT>::value >::type* dummy = 0)
|
||||
: base(x, y, RT(1)) {}
|
||||
|
||||
PointH2(const RT& hx, const RT& hy )
|
||||
: base (hx, hy, RT(1)) {}
|
||||
|
||||
PointH2(const FT& x, const FT& y)
|
||||
: base(Rat_traits().numerator(x) * Rat_traits().denominator(y),
|
||||
Rat_traits().numerator(y) * Rat_traits().denominator(x),
|
||||
|
|
|
|||
|
|
@ -57,10 +57,11 @@ public:
|
|||
PointH3(const Origin &)
|
||||
: base (RT(0), RT(0), RT(0), RT(1)) { }
|
||||
|
||||
PointH3(int x, int y, int z)
|
||||
: base(x, y, z, RT(1)) {}
|
||||
|
||||
PointH3(const RT& x, const RT& y, const RT& z)
|
||||
template < typename Tx, typename Ty, typename Tz >
|
||||
PointH3(const Tx & x, const Ty & y, const Tz & z,
|
||||
typename boost::enable_if_c<boost::is_convertible<Tx, RT>::value &&
|
||||
boost::is_convertible<Ty, RT>::value &&
|
||||
boost::is_convertible<Tz, RT>::value >::type* dummy = 0)
|
||||
: base(x, y, z, RT(1)) {}
|
||||
|
||||
PointH3(const FT& x, const FT& y, const FT& z)
|
||||
|
|
|
|||
|
|
@ -2965,16 +2965,9 @@ namespace HomogeneousKernelFunctors {
|
|||
operator()(Return_base_tag, Origin o) const
|
||||
{ return Rep(o); }
|
||||
|
||||
template < typename Tx, typename Ty >
|
||||
Rep // Point_2
|
||||
operator()(Return_base_tag, int x, int y) const
|
||||
{ return Rep(x, y); }
|
||||
|
||||
Rep // Point_2
|
||||
operator()(Return_base_tag, const RT& x, const RT& y) const
|
||||
{ return Rep(x, y); }
|
||||
|
||||
Rep // Point_2
|
||||
operator()(Return_base_tag, const FT& x, const FT& y) const
|
||||
operator()(Return_base_tag, const Tx & x, const Ty & y) const
|
||||
{ return Rep(x, y); }
|
||||
|
||||
Rep // Point_2
|
||||
|
|
@ -3007,16 +3000,9 @@ namespace HomogeneousKernelFunctors {
|
|||
operator()(Origin o) const
|
||||
{ return this->operator()(Return_base_tag(), o); }
|
||||
|
||||
template < typename Tx, typename Ty >
|
||||
Point_2
|
||||
operator()(int x, int y) const
|
||||
{ return this->operator()(Return_base_tag(), x, y); }
|
||||
|
||||
Point_2
|
||||
operator()(const RT& x, const RT& y) const
|
||||
{ return this->operator()(Return_base_tag(), x, y); }
|
||||
|
||||
Point_2
|
||||
operator()(const FT& x, const FT& y) const
|
||||
operator()(const Tx & x, const Ty & y) const
|
||||
{ return this->operator()(Return_base_tag(), x, y); }
|
||||
|
||||
Point_2
|
||||
|
|
@ -3039,12 +3025,9 @@ namespace HomogeneousKernelFunctors {
|
|||
operator()(Return_base_tag, Origin o) const
|
||||
{ return Rep(o); }
|
||||
|
||||
template < typename Tx, typename Ty, typename Tz >
|
||||
Rep // Point_3
|
||||
operator()(Return_base_tag, int x, int y, int z) const
|
||||
{ return Rep(x, y, z); }
|
||||
|
||||
Rep // Point_3
|
||||
operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const
|
||||
operator()(Return_base_tag, const Tx& x, const Ty& y, const Tz& z) const
|
||||
{ return Rep(x, y, z); }
|
||||
|
||||
Rep // Point_3
|
||||
|
|
@ -3060,12 +3043,9 @@ namespace HomogeneousKernelFunctors {
|
|||
operator()(Origin o) const
|
||||
{ return this->operator()(Return_base_tag(), o); }
|
||||
|
||||
template < typename Tx, typename Ty, typename Tz >
|
||||
Point_3
|
||||
operator()(int x, int y, int z) const
|
||||
{ return this->operator()(Return_base_tag(), x, y, z); }
|
||||
|
||||
Point_3
|
||||
operator()(const RT& x, const RT& y, const RT& z) const
|
||||
operator()(const Tx& x, const Ty& y, const Tz& z) const
|
||||
{ return this->operator()(Return_base_tag(), x, y, z); }
|
||||
|
||||
Point_3
|
||||
|
|
|
|||
Loading…
Reference in New Issue