#ifndef __copy_ptr__
#define __copy_ptr__

template <typename Class> 
class copy_ptr {
public:
  Class * ptr;
  bool    own;
  copy_ptr() : ptr(0), own(true) {}
  copy_ptr(Class * p, bool o = true) : ptr(p), own(o) {}
  copy_ptr(const copy_ptr & other);
  copy_ptr & operator= (const copy_ptr & other);
  Class & operator*  () const {return *ptr;}
  Class * operator-> () const {return ptr;}
  operator bool () const {return ptr;}
  ~copy_ptr();
};

#endif

