diff options
author | weiliangc <weiliangc@chromium.org> | 2014-09-02 15:43:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-02 22:46:47 +0000 |
commit | c1878c6c7218b3e76878cce50589f623802c7685 (patch) | |
tree | b88321c41644d298e50a55971f74bcf7ccc0241b /cc/base | |
parent | f1beb0004718a7f633b1018978ee77f53e68a57c (diff) | |
download | chromium_src-c1878c6c7218b3e76878cce50589f623802c7685.zip chromium_src-c1878c6c7218b3e76878cce50589f623802c7685.tar.gz chromium_src-c1878c6c7218b3e76878cce50589f623802c7685.tar.bz2 |
ScopedPtrVector change back const_iterator typedef
Calling begin() const and end() const function in ScopedPtrVector has
compiler error with const_iterator. Change back from const T* to T*.
Also since cpplint complains has to change a reference to pointer.
Review URL: https://codereview.chromium.org/534743002
Cr-Commit-Position: refs/heads/master@{#293014}
Diffstat (limited to 'cc/base')
-rw-r--r-- | cc/base/scoped_ptr_vector.h | 10 | ||||
-rw-r--r-- | cc/base/scoped_ptr_vector_unittest.cc | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/cc/base/scoped_ptr_vector.h b/cc/base/scoped_ptr_vector.h index e046648..7f86ce3 100644 --- a/cc/base/scoped_ptr_vector.h +++ b/cc/base/scoped_ptr_vector.h @@ -20,7 +20,7 @@ namespace cc { template <typename T> class ScopedPtrVector { public: - typedef typename std::vector<const T*>::const_iterator const_iterator; + typedef typename std::vector<T*>::const_iterator const_iterator; typedef typename std::vector<T*>::reverse_iterator reverse_iterator; typedef typename std::vector<T*>::const_reverse_iterator const_reverse_iterator; @@ -129,13 +129,11 @@ class ScopedPtrVector { data_.insert(position, item.release()); } - void insert_and_take(iterator position, - ScopedPtrVector<T>& other) { + void insert_and_take(iterator position, ScopedPtrVector<T>* other) { std::vector<T*> tmp_data; - for (ScopedPtrVector<T>::iterator it = other.begin(); - it != other.end(); + for (ScopedPtrVector<T>::iterator it = other->begin(); it != other->end(); ++it) { - tmp_data.push_back(other.take(it).release()); + tmp_data.push_back(other->take(it).release()); } data_.insert(position, tmp_data.begin(), tmp_data.end()); } diff --git a/cc/base/scoped_ptr_vector_unittest.cc b/cc/base/scoped_ptr_vector_unittest.cc index 8190b37..73a7f81 100644 --- a/cc/base/scoped_ptr_vector_unittest.cc +++ b/cc/base/scoped_ptr_vector_unittest.cc @@ -59,7 +59,7 @@ TEST(ScopedPtrVectorTest, InsertAndTake) { ++it; EXPECT_EQ(6, (*it)->data()); - v.insert_and_take(it, v2); + v.insert_and_take(it, &v2); EXPECT_EQ(6u, v.size()); EXPECT_EQ(1, v[0]->data()); |