SC_REF(3)
π sc::Ref< T >(3) β MPQC manual page, bestie β¨
okay so this is the full sc::Ref< T > manual-page moment from MPQC. This template class is lowkey iconic, it's giving template-class main character energy, and we're gonna cover every single detail. Slay. π«Ά
πΈ NAME πΈ
sc::Ref< T > β A template class that maintains references counts.
β¨ SYNOPSIS β¨
#include <ref.h>
- Inherits
sc::RefBase.
π Public Member Functions π
Ref ()β Create a reference to a null object.Ref (T *a)β Create a reference to the objecta.Ref (const Ref< T > &a)β Create a reference to the object referred to bya.template<class A > Ref (const Ref< A > &a)β Create a reference to the object referred to bya.~Ref ()β Delete this reference to the object.T * operator-> () constβ Returns the reference counted object.T * pointer () constβ Returns a pointer to the reference counted object.RefCount * parentpointer () constβ Implements theparentpointerpure virtual in the base class.operator T* () constβ no separate description in the source; it's just vibing there, bestie. πT & operator* () constβ Returns a C++ reference to the reference counted object.int null () constβ Return1if this is a reference to a null object.int nonnull () constβ Return!null().template<class A > int operator== (const Ref< A > &a) constβ A variety of ordering and equivalence operators are provided using theIdentityclass.template<class A > int operator>= (const Ref< A > &a) constβ part of that same ordering/equivalence set from the source; no separate blurb listed.template<class A > int operator<= (const Ref< A > &a) constβ same energy, no separate blurb listed.template<class A > int operator> (const Ref< A > &a) constβ same energy, no separate blurb listed.template<class A > int operator< (const Ref< A > &a) constβ same energy, no separate blurb listed.template<class A > int operator!= (const Ref< A > &a) constβ same energy, no separate blurb listed.int compare (const Ref< T > &a) constβ Compare two objects returning-1,0, or1.void clear ()β Refer to the null object.Ref< T > & operator= (const Ref< T > &c)β Assignment toc.template<class A > Ref< T > & operator= (const Ref< A > &c)β Assignment toc.Ref< T > & operator<< (const RefBase &a)β Assignment to the object thatareferences usingdynamic_cast.Ref< T > & operator<< (RefCount *a)β Assigns to the given base class pointer usingdynamic_cast.Ref< T > & operator= (T *cr)β Assignment tocr.void assign_pointer (T *cr)β Assignment tocr.void check_pointer () constβ Check the validity of the pointer.void ref_info (std::ostream &os) constβ Print information about the reference toos.void warn (const char *s) constβ Print a warning concerning the reference.
π¦ Additional Inherited Members π¦
The source page literally just has this heading and then moves on β no extra member details listed here, bestie. So we're not inventing any. Periodt. π
π Detailed Description π
template<class T>
class sc::Ref< T >" A template class that maintains references counts.
Several of these operations can cause a reference to an object to be replaced by a reference to a different object. If a reference to a nonnull object is eliminated, the object's reference count is decremented and the object is deleted if the reference count becomes zero. That's the lifecycle vibe. β¨
The source also has this line, and I'm quoting it because the wording is a little wild: "There also may be a to convert to T*, where T is the type of the object which Ref references." Some compilers have bugs that prevent the use of operator T*(). The pointer() member should be used instead β fr fr, ngl, use pointer().
π Constructor & Destructor Documentation π
π§ template<class T > sc::Ref< T >::~Ref () [inline]
Delete this reference to the object. Decrement the object's reference count and delete the object if the count is zero. π
π Member Function Documentation π
β template<class T > int sc::Ref< T >::compare (const Ref< T > & a) const [inline]
Compare two objects returning -1, 0, or 1. Similar to the C library routine strcmp. π
β template<class T > int sc::Ref< T >::null () const [inline]
Return 1 if this is a reference to a null object. Otherwise return 0.
β template<class T > T& sc::Ref< T >::operator* () const [inline]
Returns a C++ reference to the reference counted object. The behaviour is undefined if the object is null.
β οΈ Undefined behaviour if the object is null β do not test that, bestie. π
β template<class T > T* sc::Ref< T >::operator-> () const [inline]
Returns the reference counted object. The behaviour is undefined if the object is null.
β οΈ Again: undefined behaviour if the object is null. Do not play with that. π
β template<class T > Ref<T>& sc::Ref< T >::operator<< (RefCount * a) [inline]
Assigns to the given base class pointer using dynamic_cast. If the dynamic_cast fails and the argument is nonnull and has a reference count of zero, then it is deleted. π₯
πΈ Author πΈ
Generated automatically by Doxygen for MPQC from the source code.
okay bestie, that's the whole page. Version 2.3.1, dated Sun Oct 4 2020, and we're out. πβ¨
π¦ where this page comes from
- ubuntu jammy: libsc-doc 2.3.1-21
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms