summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2011-01-22 21:48:06 -0800
committerNathan Binkert <nate@binkert.org>2011-01-22 21:48:06 -0800
commit048b1e5843494be33b08cd42a3f0bb16e5d320cc (patch)
treef88d2c82dbe5b63b735bc86ff6c06353f74ae0bc /src/base
parent0e64e1be0fc1ec7586dfb2171585608f713bfc4e (diff)
downloadgem5-048b1e5843494be33b08cd42a3f0bb16e5d320cc.tar.xz
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 (limited to 'src/base')
-rw-r--r--src/base/refcnt.hh12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/base/refcnt.hh b/src/base/refcnt.hh
index b73183a1a..1c10cc0ea 100644
--- a/src/base/refcnt.hh
+++ b/src/base/refcnt.hh
@@ -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 @@ class RefCountingPtr
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)