4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Yonat Sharon http://ootips.org/yonat/
9 * simple copy-on-create/assign pointer.
11 * Note: If the actual object pointed to belongs to a derived class,
12 * then copied_ptr will not create a copy of the derived class object,
13 * but a new base class object.
14 * If you want to use a polymorphic copy-on-assign pointer, use
27 explicit copied_ptr(T * = 0);
29 copied_ptr(copied_ptr const &);
30 copied_ptr & operator=(copied_ptr const &);
32 T & operator*() const;
33 T * operator->() const;
38 void copy(copied_ptr const &);
43 copied_ptr<T>::copied_ptr(T * p)
49 copied_ptr<T>::~copied_ptr()
56 copied_ptr<T>::copied_ptr(copied_ptr const & other)
63 copied_ptr<T> & copied_ptr<T>::operator=(copied_ptr const & other)
74 T & copied_ptr<T>::operator*() const
81 T * copied_ptr<T>::operator->() const
88 T * copied_ptr<T>::get() const
95 void copied_ptr<T>::copy(copied_ptr const & other)
97 ptr_ = other.ptr_ ? new T(*other.ptr_) : 0;
100 } // namespace support
103 #endif // NOT COPIED_PTR_H