Name

PtrBase — Smart pointer.

Synopsis

template<typename T> 
class PtrBase {
public:
  // types
  typedef T OriginalType;

  // construct/copy/destruct
  PtrBase();
  PtrBase(T *);

  // public member functions

  T * pointer() const;
  T * getPtr() const;
  T * get() const;
  T * release() ;
  T * operator->() const;
  T & operator*() const;
  bool isNull() const;
  bool operator!() const;
  operator bool() const;
  bool operator<(const PtrBase &) const;
  bool operator<(const T *) const;
  bool operator>(const PtrBase &) const;
  bool operator>(const T *) const;
  bool operator<=(const PtrBase &) const;
  bool operator<=(const T *) const;
  bool operator>=(const PtrBase &) const;
  bool operator>=(const T *) const;
};

Description

Base class for smart pointers

Defines functions which are common for all smart Ptr's (comparsions etc).

PtrBase construct/copy/destruct

  1. PtrBase();

    Construct null pointer.


  2. PtrBase(T * p);

    Construct from a dumb pointer.


PtrBase public member functions

  1. T * pointer() const;

    Returns raw pointer to the object.


  2. T * getPtr() const;


  3. T * get() const;


  4. T * release() ;

    Extract pointer to the kept object and release it.


  5. T * operator->() const;

    Dereference operator ->


  6. T & operator*() const;

    Dereference operator *.


  7. bool isNull() const;

    Check whether owned pointer is NULL.


  8. bool operator!() const;

    Synonymous to isNull().


  9. operator bool() const;

    Checks if pointer is non-NULL.


  10. bool operator<(const PtrBase & rhs) const;

    Checks that the current pointer is less than rhs.


  11. bool operator<(const T * rhs) const;

    Checks that the current pointer is less than rhs.


  12. bool operator>(const PtrBase & rhs) const;

    Checks that the current pointer is greater than rhs.


  13. bool operator>(const T * rhs) const;

    Checks that the current pointer is greater than rhs.


  14. bool operator<=(const PtrBase & rhs) const;

    Checks that the current pointer is less or equal than rhs.


  15. bool operator<=(const T * rhs) const;

    Checks that the current pointer is less or equal than rhs.


  16. bool operator>=(const PtrBase & rhs) const;

    Checks that the current pointer is greater or equal than rhs.


  17. bool operator>=(const T * rhs) const;

    Checks that the current pointer is greater or equal than rhs.