Skip to content

Commit

Permalink
Merge pull request #19194 from ghalliday/issue32796
Browse files Browse the repository at this point in the history
HPCC-32796 Use default initialiser for pointer in Owned/Linked class

Reviewed-By: Anthony Fishbeck <[email protected]>
Reviewed-by: Mark Kelly [email protected]
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Oct 16, 2024
2 parents 8321d83 + b6e98a5 commit 9d3734f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions system/jlib/jscm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ template <class X> inline void Release(X * ptr) { if (ptr) ptr->Release(); }
template <class CLASS> class Shared
{
public:
inline Shared() { ptr = NULL; }
constexpr inline Shared() = default;
inline Shared(CLASS * _ptr, bool owned) { ptr = _ptr; if (!owned && _ptr) _ptr->Link(); }
inline Shared(const Shared & other) { ptr = other.getLink(); }
#if defined(__cplusplus) && __cplusplus >= 201100
Expand Down Expand Up @@ -107,15 +107,15 @@ template <class CLASS> class Shared
inline Shared<CLASS> & operator = (const CLASS * other);

private:
CLASS * ptr;
CLASS * ptr = nullptr;
};


//An Owned Shared object takes ownership of the pointer that is passed in the constructor.
template <class CLASS> class Owned : public Shared<CLASS>
{
public:
inline Owned() { }
constexpr inline Owned() = default;
inline Owned(CLASS * _ptr) : Shared<CLASS>(_ptr) { }

inline Shared<CLASS> & operator = (const Shared<CLASS> & other) { this->set(other.get()); return *this; }
Expand All @@ -130,7 +130,7 @@ template <class CLASS> class Owned : public Shared<CLASS>
template <class CLASS> class Linked : public Shared<CLASS>
{
public:
inline Linked() { }
constexpr inline Linked() = default;
inline Linked(CLASS * _ptr) : Shared<CLASS>(LINK(_ptr)) { }
inline Linked(const Shared<CLASS> & other) : Shared<CLASS>(other) { }

Expand Down

0 comments on commit 9d3734f

Please sign in to comment.