Added copy constructors to classes with copy assignment operator defined

and copy assignment operator for classes with a copy constructor

This is often described as the rule of 3 (or rule of 5 in C++11 if move
constructors and assignment operators are also defined) and makes good sense in
ensuring consistency.  For classes in which the default bitwise copy constructor
or assignment operator are appropriate these are now specified explicitly using
the "= default" keyword if the other is explicitly defined fulfilling the rule
of 3 without the need to define the body of the function.
This commit is contained in:
Henry Weller
2019-06-05 23:32:22 +01:00
parent 74d45a1313
commit 00ae415b71
92 changed files with 200 additions and 642 deletions

View File

@ -111,9 +111,6 @@ public:
//- Construct from origin, distance
inline patchEdgeFaceInfo(const point&, const scalar);
//- Copy constructor
inline patchEdgeFaceInfo(const patchEdgeFaceInfo&);
// Member Functions

View File

@ -117,7 +117,6 @@ inline bool Foam::patchEdgeFaceInfo::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo()
:
origin_(point::max),
@ -125,7 +124,6 @@ inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo()
{}
// Construct from origin, distance
inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo
(
const point& origin,
@ -137,14 +135,6 @@ inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo
{}
// Copy constructor
inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo(const patchEdgeFaceInfo& wpt)
:
origin_(wpt.origin()),
distSqr_(wpt.distSqr())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::point& Foam::patchEdgeFaceInfo::origin() const

View File

@ -112,9 +112,6 @@ public:
//- Construct from origin, distance
inline pointEdgePoint(const point&, const scalar);
//- Copy constructor
inline pointEdgePoint(const pointEdgePoint&);
// Member Functions

View File

@ -117,7 +117,6 @@ inline bool Foam::pointEdgePoint::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::pointEdgePoint::pointEdgePoint()
:
origin_(point::max),
@ -125,7 +124,6 @@ inline Foam::pointEdgePoint::pointEdgePoint()
{}
// Construct from origin, distance
inline Foam::pointEdgePoint::pointEdgePoint
(
const point& origin,
@ -137,14 +135,6 @@ inline Foam::pointEdgePoint::pointEdgePoint
{}
// Copy constructor
inline Foam::pointEdgePoint::pointEdgePoint(const pointEdgePoint& wpt)
:
origin_(wpt.origin()),
distSqr_(wpt.distSqr())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::point& Foam::pointEdgePoint::origin() const