refcnt: no default copy contructor or copy operator
authorNathan Binkert <nate@binkert.org>
Fri, 2 Apr 2010 18:20:32 +0000 (11:20 -0700)
committerNathan Binkert <nate@binkert.org>
Fri, 2 Apr 2010 18:20:32 +0000 (11:20 -0700)
We shouldn't allow these because the default versions will copy
the reference count which is definitely not what we want.

src/base/refcnt.hh

index d1663ad7297781acbb901cfc85935608b6026403..64224ca7f357ce132474823936db5ef0ebcbf809 100644 (file)
@@ -37,7 +37,11 @@ class RefCounted
     int count;
 
   private:
+    // Don't allow a default copy constructor or copy operator on
+    // these objects because the default operation will copy the
+    // reference count as well and we certainly don't want that.
     RefCounted(const RefCounted &);
+    RefCounted &operator=(const RefCounted &);
 
   public:
     RefCounted() : count(0) {}