1 #ifndef AUTOCONSTPTR_H_
2 #define AUTOCONSTPTR_H_
5 A smart pointer that only provides non-const access to the contents if the
6 pointer itself is non-const.
15 AutoConstPtr(T *p): ptr(p) { }
16 AutoConstPtr &operator=(T *p) { ptr = p; return *this; }
17 T *operator->() { return ptr; }
18 const T *operator->() const { return ptr; }
19 operator T *() { return ptr; }
20 operator const T *() const { return ptr; }