changeset 31a04e5ac4be in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=31a04e5ac4be
description:
        refcnt: Change things around so that we handle constness correctly.
        To use a non const pointer:
        typedef RefCountingPtr<Foo> FooPtr;

        To use a const pointer:
        typedef RefCountingPtr<const Foo> ConstFooPtr;

diffstat:

 src/base/refcnt.hh |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (29 lines):

diff -r d38c1f650a4e -r 31a04e5ac4be src/base/refcnt.hh
--- a/src/base/refcnt.hh        Fri Jan 21 17:51:22 2011 -0800
+++ b/src/base/refcnt.hh        Sat Jan 22 21:48:06 2011 -0800
@@ -34,7 +34,7 @@
 class RefCounted
 {
   private:
-    int count;
+    mutable int count;
 
   private:
     // Don't allow a default copy constructor or copy operator on
@@ -84,13 +84,9 @@
     RefCountingPtr(const RefCountingPtr &r) { copy(r.data); }
     ~RefCountingPtr() { del(); }
 
-    T *operator->() { return data; }
-    T &operator*() { return *data; }
-    T *get() { return data; }
-
-    const T *operator->() const { return data; }
-    const T &operator*() const { return *data; }
-    const T *get() const { return data; }
+    T *operator->() const { return data; }
+    T &operator*() const { return *data; }
+    T *get() const { return data; }
 
     const RefCountingPtr &operator=(T *p) { set(p); return *this; }
     const RefCountingPtr &operator=(const RefCountingPtr &r)
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to