summaryrefslogtreecommitdiffstats
path: root/base/memory
diff options
context:
space:
mode:
authorgroby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-01 23:26:14 +0000
committergroby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-01 23:26:14 +0000
commitf3a8f42a976f6465db0294974184800eef6e474b (patch)
tree27d0062e3a0d6a22ed7f7281eae1b4041d6d7ac1 /base/memory
parentaf3e1ea36391260306ee2b03f86f03b087f82f29 (diff)
downloadchromium_src-f3a8f42a976f6465db0294974184800eef6e474b.zip
chromium_src-f3a8f42a976f6465db0294974184800eef6e474b.tar.gz
chromium_src-f3a8f42a976f6465db0294974184800eef6e474b.tar.bz2
ScopedVector - fix const semantics.
const std::vector<T*> returns a const reference to a T* for operator[]. const ScopedVector<T> instead returns a const T*, which means the two have slightly differing semantics. Fix ScopedVector to behave like std::vector instead - the reference to the pointer is const, but the pointer is not const. TBR=willchan@chromium.org R=brettw@chromium.org Review URL: https://chromiumcodereview.appspot.com/18131002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209537 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/memory')
-rw-r--r--base/memory/scoped_vector.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/base/memory/scoped_vector.h b/base/memory/scoped_vector.h
index 90a1f7d..59144c0 100644
--- a/base/memory/scoped_vector.h
+++ b/base/memory/scoped_vector.h
@@ -41,8 +41,8 @@ class ScopedVector {
return *this;
}
- T*& operator[](size_t index) { return v_[index]; }
- const T* operator[](size_t index) const { return v_[index]; }
+ reference operator[](size_t index) { return v_[index]; }
+ const_reference operator[](size_t index) const { return v_[index]; }
bool empty() const { return v_.empty(); }
size_t size() const { return v_.size(); }