@@ -215,15 +215,14 @@ class RefCountersImpl : public IReferenceCounters
215215 return m_NumWeakReferences.load ();
216216 }
217217
218- protected :
218+ private :
219219 template <typename AllocatorType, typename ObjectType>
220220 friend class MakeNewRCObj ;
221221
222222 RefCountersImpl () noexcept
223223 {
224224 }
225225
226- private:
227226 class ObjectWrapperBase
228227 {
229228 public:
@@ -449,16 +448,17 @@ class RefCountersImpl : public IReferenceCounters
449448 }
450449 }
451450
452- protected:
453- virtual void SelfDestroy () = 0;
451+ virtual void SelfDestroy ()
452+ {
453+ delete this ;
454+ }
454455
455456 ~RefCountersImpl ()
456457 {
457458 VERIFY (m_NumStrongReferences.load () == 0 && m_NumWeakReferences.load () == 0 ,
458459 " There exist outstanding references to the object being destroyed" );
459460 }
460461
461- private:
462462 // No copies/moves
463463 // clang-format off
464464 RefCountersImpl (const RefCountersImpl&) = delete ;
@@ -492,21 +492,6 @@ class RefCountersImpl : public IReferenceCounters
492492 std::atomic<ObjectState> m_ObjectState{ObjectState::NotInitialized};
493493};
494494
495- class RefCountersAllocationImpl final : public RefCountersImpl
496- {
497- private:
498- template <typename AllocatorType, typename ObjectType>
499- friend class MakeNewRCObj ;
500-
501- RefCountersAllocationImpl () noexcept
502- {
503- }
504-
505- void SelfDestroy () override final
506- {
507- delete this ;
508- }
509- };
510495
511496// / Base class for all reference counting objects
512497template <typename Base>
@@ -669,7 +654,7 @@ class MakeNewRCObj
669654 {
670655 // Constructor of RefCountersImpl class is private and only accessible
671656 // by methods of MakeNewRCObj
672- pNewRefCounters = new RefCountersAllocationImpl {};
657+ pNewRefCounters = new RefCountersImpl {};
673658 pRefCounters = pNewRefCounters;
674659 }
675660 ObjectType* pObj = nullptr ;
0 commit comments