default copy constructor and assignment operator in Point2 and Point3
This commit is contained in:
parent
6228d92fec
commit
c7fd93063e
|
|
@ -127,14 +127,20 @@ public:
|
||||||
_v[0] = nx; _v[1] = ny;
|
_v[0] = nx; _v[1] = ny;
|
||||||
}
|
}
|
||||||
/// copy constructor
|
/// copy constructor
|
||||||
inline Point2 ( const Point2 & p)
|
inline Point2 ( const Point2 & p) = default;
|
||||||
|
/// copy constructor
|
||||||
|
template<class Q>
|
||||||
|
inline Point2 ( const Point2<Q> & p)
|
||||||
{
|
{
|
||||||
_v[0]= p._v[0]; _v[1]= p._v[1];
|
_v[0]= p[0]; _v[1]= p[1];
|
||||||
}
|
}
|
||||||
/// copy
|
/// copy
|
||||||
inline Point2 & operator =( const Point2 & p)
|
inline Point2 & operator =( const Point2 & p) = default;
|
||||||
|
/// copy
|
||||||
|
template<class Q>
|
||||||
|
inline Point2 & operator =( const Point2<Q> & p)
|
||||||
{
|
{
|
||||||
_v[0]= p._v[0]; _v[1]= p._v[1];
|
_v[0]= p[0]; _v[1]= p[1];
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
/// sets the point to (0,0)
|
/// sets the point to (0,0)
|
||||||
|
|
|
||||||
|
|
@ -133,21 +133,34 @@ public:
|
||||||
_v[1] = ny;
|
_v[1] = ny;
|
||||||
_v[2] = nz;
|
_v[2] = nz;
|
||||||
}
|
}
|
||||||
inline Point3 ( Point3 const & p )
|
|
||||||
|
/** Default copy constructor */
|
||||||
|
inline Point3 ( Point3 const & p ) = default;
|
||||||
|
|
||||||
|
/** Copy from Point with different template */
|
||||||
|
template<class Q>
|
||||||
|
inline Point3 ( Point3<Q> const & p )
|
||||||
{
|
{
|
||||||
_v[0]= p._v[0];
|
_v[0]= p[0];
|
||||||
_v[1]= p._v[1];
|
_v[1]= p[1];
|
||||||
_v[2]= p._v[2];
|
_v[2]= p[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Point3 ( const P3ScalarType nv[3] )
|
inline Point3 ( const P3ScalarType nv[3] )
|
||||||
{
|
{
|
||||||
_v[0] = nv[0];
|
_v[0] = nv[0];
|
||||||
_v[1] = nv[1];
|
_v[1] = nv[1];
|
||||||
_v[2] = nv[2];
|
_v[2] = nv[2];
|
||||||
}
|
}
|
||||||
inline Point3 & operator =(Point3 const & p)
|
|
||||||
|
/** Default copy assignment */
|
||||||
|
inline Point3 & operator =(Point3 const & p) = default;
|
||||||
|
|
||||||
|
/** Copy assignment from Point with different template */
|
||||||
|
template<class Q>
|
||||||
|
inline Point3 & operator =(Point3<Q> const & p)
|
||||||
{
|
{
|
||||||
_v[0] = p._v[0]; _v[1] = p._v[1]; _v[2] = p._v[2];
|
_v[0] = p[0]; _v[1] = p[1]; _v[2] = p[2];
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
inline void SetZero()
|
inline void SetZero()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue