/trunk/Examples/python/smartptr/smartptr.h

# · C++ Header · 13 lines · 12 code · 1 blank · 0 comment · 0 complexity · 65f291177990921a7e65c7b5c012f351 MD5 · raw file

  1. template<class T> class SmartPtr {
  2. public:
  3. SmartPtr(T *realPtr = 0) { pointee = realPtr; }
  4. T *operator->() const {
  5. return pointee;
  6. }
  7. T &operator*() const {
  8. return *pointee;
  9. }
  10. private:
  11. T *pointee;
  12. };