diff --git a/src/templates/smartp.hh b/src/templates/smartp.hh index 09458d5..04111b6 100644 --- a/src/templates/smartp.hh +++ b/src/templates/smartp.hh @@ -22,6 +22,10 @@ namespace memory { /** \brief A simple reference counted smart pointer + * + * \author Matteo Settenvini + * \version 1.0 + * \date October 2005 * * This template is a smart pointer which uses * a simple mechanism of reference count to @@ -48,13 +52,28 @@ namespace memory { * */ static const smart_ptr null; - /** Call this constructor only the first time. Whenever + /** \brief Constructor, defaults to null pointer. + * + * Call this constructor only the first time. Whenever * you'll need to keep other references to the same pointer, * use the cctor, or we won't be able to keep updated the * reference count. This class requires some effort from * the user to abid to some rules. It's meant to be - * an help, not a painkiller. */ + * an help, not a painkiller. + * + * A good usage of this ctor is: + * \code + * class C; + * smart_ptr c_ptr(new C()); + * \endcode + * So you don't keep a potentially dangerous reference + * around. */ smart_ptr(T* ptr = 0) throw(std::bad_alloc); + + /** \brief Copy constructor. + * + * Always use this to obtain another reference + * to a stored pointer. */ smart_ptr(const smart_ptr& sptr) throw(); ~smart_ptr() throw();