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

Unified Diff: net/base/linked_hash_map.h

Issue 647883002: git cl format the final third of the net/base directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
Index: net/base/linked_hash_map.h
diff --git a/net/base/linked_hash_map.h b/net/base/linked_hash_map.h
index b024ca1d5361d46f958051b096d668b61412ce6c..2936ec4a93b906f1d152e5a95c8ab15eb4163517 100644
--- a/net/base/linked_hash_map.h
+++ b/net/base/linked_hash_map.h
@@ -27,7 +27,7 @@
//
// We also keep a map<Key, list::iterator> for find. Since std::list is a
// doubly-linked list, the iterators should remain stable.
-template<class Key, class Value>
+template <class Key, class Value>
class linked_hash_map {
private:
typedef std::list<std::pair<Key, Value> > ListType;
@@ -42,64 +42,39 @@ class linked_hash_map {
typedef typename ListType::value_type value_type;
typedef typename ListType::size_type size_type;
- linked_hash_map() : map_(), list_() {
- }
+ linked_hash_map() : map_(), list_() {}
// Returns an iterator to the first (insertion-ordered) element. Like a map,
// this can be dereferenced to a pair<Key, Value>.
- iterator begin() {
- return list_.begin();
- }
- const_iterator begin() const {
- return list_.begin();
- }
+ iterator begin() { return list_.begin(); }
+ const_iterator begin() const { return list_.begin(); }
// Returns an iterator beyond the last element.
- iterator end() {
- return list_.end();
- }
- const_iterator end() const {
- return list_.end();
- }
+ iterator end() { return list_.end(); }
+ const_iterator end() const { return list_.end(); }
// Returns an iterator to the last (insertion-ordered) element. Like a map,
// this can be dereferenced to a pair<Key, Value>.
- reverse_iterator rbegin() {
- return list_.rbegin();
- }
- const_reverse_iterator rbegin() const {
- return list_.rbegin();
- }
+ reverse_iterator rbegin() { return list_.rbegin(); }
+ const_reverse_iterator rbegin() const { return list_.rbegin(); }
// Returns an iterator beyond the first element.
- reverse_iterator rend() {
- return list_.rend();
- }
- const_reverse_iterator rend() const {
- return list_.rend();
- }
+ reverse_iterator rend() { return list_.rend(); }
+ const_reverse_iterator rend() const { return list_.rend(); }
// Front and back accessors common to many stl containers.
// Returns the earliest-inserted element
- const value_type& front() const {
- return list_.front();
- }
+ const value_type& front() const { return list_.front(); }
// Returns the earliest-inserted element.
- value_type& front() {
- return list_.front();
- }
+ value_type& front() { return list_.front(); }
// Returns the most-recently-inserted element.
- const value_type& back() const {
- return list_.back();
- }
+ const value_type& back() const { return list_.back(); }
// Returns the most-recently-inserted element.
- value_type& back() {
- return list_.back();
- }
+ value_type& back() { return list_.back(); }
// Clears the map of all values.
void clear() {
@@ -108,15 +83,14 @@ class linked_hash_map {
}
// Returns true iff the map is empty.
- bool empty() const {
- return list_.empty();
- }
+ bool empty() const { return list_.empty(); }
// Erases values with the provided key. Returns the number of elements
// erased. In this implementation, this will be 0 or 1.
size_type erase(const Key& key) {
typename MapType::iterator found = map_.find(key);
- if (found == map_.end()) return 0;
+ if (found == map_.end())
+ return 0;
list_.erase(found->second);
map_.erase(found);
@@ -174,12 +148,12 @@ class linked_hash_map {
std::pair<const_iterator, const_iterator> equal_range(
const key_type& key) const {
std::pair<typename MapType::const_iterator,
- typename MapType::const_iterator> eq_range =
+ typename MapType::const_iterator> eq_range =
map_.equal_range(key);
- const const_iterator& start_iter = eq_range.first != map_.end() ?
- eq_range.first->second : end();
- const const_iterator& end_iter = eq_range.second != map_.end() ?
- eq_range.second->second : end();
+ const const_iterator& start_iter =
+ eq_range.first != map_.end() ? eq_range.first->second : end();
+ const const_iterator& end_iter =
+ eq_range.second != map_.end() ? eq_range.second->second : end();
return std::make_pair(start_iter, end_iter);
}
@@ -196,7 +170,8 @@ class linked_hash_map {
// return a pair with an iterator to it, and false indicating that we
// didn't insert anything.
typename MapType::iterator found = map_.find(pair.first);
- if (found != map_.end()) return std::make_pair(found->second, false);
+ if (found != map_.end())
+ return std::make_pair(found->second, false);
// Otherwise, insert into the list first.
list_.push_back(pair);
@@ -212,9 +187,7 @@ class linked_hash_map {
return std::make_pair(last, true);
}
- size_type size() const {
- return list_.size();
- }
+ size_type size() const { return list_.size(); }
void swap(linked_hash_map& other) {
map_.swap(other.map_);

Powered by Google App Engine
This is Rietveld 408576698