From c4c4ef378fb2684bfeeb0f715e97c1a6bead82c4 Mon Sep 17 00:00:00 2001 From: tchernobog Date: Mon, 20 Feb 2006 12:56:28 +0000 Subject: [PATCH] - Fix documentation a little git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@359 3ecf2c5c-341e-0410-92b4-d18e462d057c --- src/templates/smartp.hh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) 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();