Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2818)

Unified Diff: chrome/common/scoped_vector.h

Issue 107001: Move scoped_vector.h and stl_util-inl.h to base/ (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/pref_service.cc ('k') | chrome/common/sqlite_compiled_statement.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/scoped_vector.h
===================================================================
--- chrome/common/scoped_vector.h (revision 15263)
+++ chrome/common/scoped_vector.h (working copy)
@@ -1,51 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_COMMON_SCOPED_VECTOR_H__
-#define CHROME_BROWSER_COMMON_SCOPED_VECTOR_H__
-
-#include <vector>
-
-#include "chrome/common/stl_util-inl.h"
-
-// ScopedVector wraps a vector deleting the elements from its
-// destructor.
-template <class T>
-class ScopedVector {
- public:
- typedef typename std::vector<T*>::iterator iterator;
- typedef typename std::vector<T*>::const_iterator const_iterator;
-
- ScopedVector() {}
- ~ScopedVector() { reset(); }
-
- std::vector<T*>* operator->() { return &v; }
- const std::vector<T*>* operator->() const { return &v; }
- T* operator[](size_t i) { return v[i]; }
- const T* operator[](size_t i) const { return v[i]; }
-
- bool empty() const { return v.empty(); }
- size_t size() const { return v.size(); }
-
- iterator begin() { return v.begin(); }
- const_iterator begin() const { return v.begin(); }
- iterator end() { return v.end(); }
- const_iterator end() const { return v.end(); }
-
- void push_back(T* elem) { v.push_back(elem); }
-
- std::vector<T*>& get() { return v; }
- const std::vector<T*>& get() const { return v; }
- void swap(ScopedVector<T>& other) { v.swap(other.v); }
- void release(std::vector<T*>* out) { out->swap(v); v.clear(); }
-
- void reset() { STLDeleteElements(&v); }
-
- private:
- std::vector<T*> v;
-
- DISALLOW_EVIL_CONSTRUCTORS(ScopedVector);
-};
-
-#endif // CHROME_BROWSER_COMMON_SCOPED_VECTOR_H__
« no previous file with comments | « chrome/common/pref_service.cc ('k') | chrome/common/sqlite_compiled_statement.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698