Author: wyoung
Date: Wed Nov 28 05:32:37 2007
New Revision: 1905

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1905&view=rev
Log:
Gave RefCountedPointer a separate default ctor: it used to have one
taking T*, defaulting to 0 to give the same effect, but since it's
explicit it's not clear what RefCountedPointer<T> f; means: will the
compiler call the explicit T* ctor with 0, or will it use a compiler-
generated version which will leave the internal pointers uninitted?
Doesn't matter if its previous behavior was correct, the confusion is
reason enough to separate these.

Modified:
    trunk/lib/refcounted.h

Modified: trunk/lib/refcounted.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/refcounted.h?rev=1905&r1=1904&r2=1905&view=diff
==============================================================================
--- trunk/lib/refcounted.h (original)
+++ trunk/lib/refcounted.h Wed Nov 28 05:32:37 2007
@@ -66,13 +66,23 @@
 {
 public:
        typedef RefCountedPointer<T> ThisType;  ///< alias for this object's 
type
+
+       /// \brief Default constructor
+       ///
+       /// An object constructed this way is useless until you vivify it
+       /// with operator =() or assign().
+       RefCountedPointer() :
+       counted_(0),
+       refs_(0)
+       {
+       }
        
        /// \brief Standard constructor
        ///
-       /// \param c A pointer to the managed object.  If you leave it at
-       /// its default (or pass 0 explicitly) this object is useless until
-       /// you vivify it with operator =() or assign().
-       explicit RefCountedPointer(T* c = 0) :
+       /// \param c A pointer to the object to be managed.  If you pass 0,
+       /// it's like calling the default ctor instead, only more work: the
+       /// object's useless until you vivify it with operator =() or assign().
+       explicit RefCountedPointer(T* c) :
        counted_(c),
        refs_(c ? new size_t(1) : 0)
        {


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to