ZIPIOS_SIMPLESMARTPOINTER(3)

πŸ“¦
version 0.1.5.9+cvs.2007.04.28 Β· 2 versions
, in ubuntu jammy

πŸ’– NAME πŸ’–

zipios::SimpleSmartPointer< Type > β€” bestie, this is a simple reference counting smart pointer template. That's the whole vibe. ✨


🌸 SYNOPSIS 🌸

This is a page from the Library Functions Manual, and okay so here's how you actually get to it:

#include <simplesmartptr.h>

✨ Public Member Functions ✨

  • Type * operator-> () const β€” arrow goes brrr, gives you the pointee.
  • Type & operator* () const β€” deref, hands you the actual object.
  • SimpleSmartPointer (Type *p=0) β€” constructor, takes a raw pointer (defaults to 0, ngl).
  • template<class T2 > SimpleSmartPointer (const SimpleSmartPointer< T2 > &src) β€” templated copy-ish constructor, converts from a SimpleSmartPointer of another type.
  • SimpleSmartPointer (const SimpleSmartPointer &src) β€” the regular copy constructor.
  • template<class T2 > SimpleSmartPointer & operator= (const SimpleSmartPointer< T2 > &src) β€” templated assignment from a SimpleSmartPointer< T2 >.
  • SimpleSmartPointer & operator= (const SimpleSmartPointer &src) β€” assignment from another SimpleSmartPointer.
  • SimpleSmartPointer & operator= (Type *src) β€” assignment from a raw pointer, iconic.
  • bool operator== (const Type *p) const β€” compares against a raw Type *.
  • bool operator!= (const Type *p) const β€” not-equals against a raw Type *.
  • bool operator== (const SimpleSmartPointer &sp) const β€” compares against another SimpleSmartPointer.
  • bool operator!= (const SimpleSmartPointer &sp) const β€” not-equals against another SimpleSmartPointer.
  • bool operator! () const β€” the "is this thing empty" check, chef's kiss.
  • operator void * () const β€” converts to void *.
  • Type * get () const β€” gives you back the raw pointer, no cap.
  • unsigned int getReferenceCount () const β€” Returns the reference count - For debugging purposes. πŸ•΅οΈβ€β™€οΈ

πŸ¦‹ Detailed Description πŸ¦‹

template<class Type>
class zipios::SimpleSmartPointer< Type >" SimpleSmartPointer is a simple
reference counting smart pointer template.

So here's the tea: the type you point at must keep a reference count that's reachable through these two methods, exactly:

  • void ref() const
  • unsigned int unref() const

And not only does it have to have them β€” it has to handle the reference count properly. If it doesn't, that's a you problem and it will absolutely come for you. 😭 The easiest way to do all that correctly is to just use the ReferenceCount template class. Do that. Periodt.

Definition at line 15 of file simplesmartptr.h.

πŸ‘‘ Member Function Documentation πŸ‘‘

πŸŽ€ template<class Type > unsigned int zipios::SimpleSmartPointer< Type >::getReferenceCount () const [inline]

Returns the reference count - For debugging purposes. That's it, that's the function. πŸ’…

Definition at line 67 of file simplesmartptr.h.

🫢 Author 🫢

Generated automatically by Doxygen for Zipios++ from the source code. Not a human bestie typing this out, it's the machine. πŸ€–


And that's the whole page, bestie! This was Zipios++, dated Tue Mar 24 2020, and the page you're reading is zipios::SimpleSmartPointer< Type >(3). Slay, go write some reference-counted pointers. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from