Merge the various constructors into a template to avoid ambiguities

This commit is contained in:
Sylvain Pion 2006-08-08 08:24:09 +00:00
parent ed25e93dc9
commit 7ab36784b9
4 changed files with 13 additions and 70 deletions

View File

@ -67,21 +67,8 @@ public:
{}
#endif
Point_2(int x, int y)
: Rep(typename R::Construct_point_2()(x, y).rep())
{}
Point_2(const RT& x, const RT& y)
: RPoint_2(typename R::Construct_point_2()(x, y).rep())
{}
Point_2(const typename First_if_different<double,RT>::Type& x,
const typename First_if_different<double,RT>::Type& y)
: Rep(typename R::Construct_point_2()(x, y).rep())
{}
Point_2(const typename First_if_different<FT,RT,1>::Type& x,
const typename First_if_different<FT,RT,1>::Type& y)
template < typename T1, typename T2 >
Point_2(const T1 &x, const T2 &y)
: Rep(typename R::Construct_point_2()(x, y).rep())
{}

View File

@ -65,23 +65,8 @@ public:
: Rep(p) {}
#endif
Point_3(int x, int y, int z)
: Rep(typename R::Construct_point_3()(x, y, z).rep())
{}
Point_3(const RT& x, const RT& y, const RT& z)
: Rep(typename R::Construct_point_3()(x, y, z).rep())
{}
Point_3(const typename First_if_different<double,RT>::Type& x,
const typename First_if_different<double,RT>::Type& y,
const typename First_if_different<double,RT>::Type& z)
: Rep(typename R::Construct_point_3()(x, y, z).rep())
{}
Point_3(const typename First_if_different<FT,RT,1>::Type& x,
const typename First_if_different<FT,RT,1>::Type& y,
const typename First_if_different<FT,RT,1>::Type& z)
template < typename T1, typename T2, typename T3 >
Point_3(const T1& x, const T2& y, const T3& z)
: Rep(typename R::Construct_point_3()(x, y, z).rep())
{}

View File

@ -17,7 +17,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Andreas Fabri, Stefan Schirra
@ -73,16 +73,8 @@ public:
Vector_2(const Null_vector &v) : RVector_2(typename R::Construct_vector_2()(v).rep()) {}
Vector_2(int x, int y)
: RVector_2(typename R::Construct_vector_2()(x,y).rep())
{}
Vector_2(const typename First_if_different<double,RT>::Type& x,
const typename First_if_different<double,RT>::Type& y)
: Rep(typename R::Construct_vector_2()(x, y).rep())
{}
Vector_2(const RT &x, const RT &y)
template < typename T1, typename T2 >
Vector_2(const T1 &x, const T2 &y)
: RVector_2(typename R::Construct_vector_2()(x,y).rep())
{}
@ -90,11 +82,6 @@ public:
: RVector_2(typename R::Construct_vector_2()(x,y,w).rep())
{}
Vector_2(const typename First_if_different<FT,RT,1>::Type& x,
const typename First_if_different<FT,RT,1>::Type& y)
: Rep(typename R::Construct_vector_2()(x, y).rep())
{}
typename Qualified_result_of<typename R::Compute_x_2,Vector_2>::type
x() const
@ -102,14 +89,12 @@ public:
return R().compute_x_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_y_2,Vector_2>::type
y() const
{
return R().compute_y_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_y_2,Vector_2>::type
cartesian(int i) const
{
@ -129,7 +114,7 @@ public:
return R().compute_hx_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hy_2,Vector_2>::type
hy() const
{
@ -238,7 +223,7 @@ operator!=(const Null_vector &n, const Vector_2<R> &v)
template <class R >
std::ostream&
insert(std::ostream& os, const Vector_2<R>& v, const Cartesian_tag&)
insert(std::ostream& os, const Vector_2<R>& v, const Cartesian_tag&)
{
switch(os.iword(IO::mode)) {
case IO::ASCII :
@ -283,7 +268,7 @@ operator<<(std::ostream& os, const Vector_2<R>& v)
template <class R >
std::istream&
extract(std::istream& is, Vector_2<R>& v, const Cartesian_tag&)
extract(std::istream& is, Vector_2<R>& v, const Cartesian_tag&)
{
typename R::FT x, y;
switch(is.iword(IO::mode)) {
@ -307,7 +292,7 @@ extract(std::istream& is, Vector_2<R>& v, const Cartesian_tag&)
template <class R >
std::istream&
extract(std::istream& is, Vector_2<R>& v, const Homogeneous_tag&)
extract(std::istream& is, Vector_2<R>& v, const Homogeneous_tag&)
{
typename R::RT hx, hy, hw;
switch(is.iword(IO::mode))

View File

@ -78,24 +78,10 @@ public:
Vector_3(const Null_vector& v)
: Rep(typename R::Construct_vector_3()(v).rep()) {}
Vector_3(int x, int y, int z)
template < typename T1, typename T2, typename T3 >
Vector_3(const T1 &x, const T2 &y, const T3 &z)
: Rep(typename R::Construct_vector_3()(x, y, z).rep()) {}
Vector_3(const typename First_if_different<double,RT>::Type& x,
const typename First_if_different<double,RT>::Type& y,
const typename First_if_different<double,RT>::Type& z)
: Rep(typename R::Construct_vector_3()(x, y, z).rep())
{}
Vector_3(const RT& x, const RT& y, const RT& z)
: Rep(typename R::Construct_vector_3()(x, y, z).rep()) {}
Vector_3(const typename First_if_different<FT,RT,1>::Type& x,
const typename First_if_different<FT,RT,1>::Type& y,
const typename First_if_different<FT,RT,1>::Type& z)
: Rep(typename R::Construct_vector_3()(x, y, z).rep())
{}
Vector_3(const RT& x, const RT& y, const RT& z, const RT& w)
: Rep(typename R::Construct_vector_3()(x, y, z, w).rep()) {}