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

Side by Side Diff: third_party/WebKit/Source/wtf/HashSet.h

Issue 2696183002: Migrate WTF::HashSet::remove() to ::erase() [part 1] (Closed)
Patch Set: one more platform-specific reference Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // An alternate version of add() that finds the object by hashing and 115 // An alternate version of add() that finds the object by hashing and
116 // comparing with some other type, to avoid the cost of type conversion if 116 // comparing with some other type, to avoid the cost of type conversion if
117 // the object is already in the table. HashTranslator must have the 117 // the object is already in the table. HashTranslator must have the
118 // following function members: 118 // following function members:
119 // static unsigned hash(const T&); 119 // static unsigned hash(const T&);
120 // static bool equal(const ValueType&, const T&); 120 // static bool equal(const ValueType&, const T&);
121 // static translate(ValueType&, T&&, unsigned hashCode); 121 // static translate(ValueType&, T&&, unsigned hashCode);
122 template <typename HashTranslator, typename T> 122 template <typename HashTranslator, typename T>
123 AddResult addWithTranslator(T&&); 123 AddResult addWithTranslator(T&&);
124 124
125 void remove(ValuePeekInType); 125 void erase(ValuePeekInType);
126 void remove(iterator); 126 void remove(iterator);
127 void clear(); 127 void clear();
128 template <typename Collection> 128 template <typename Collection>
129 void removeAll(const Collection& toBeRemoved) { 129 void removeAll(const Collection& toBeRemoved) {
130 WTF::removeAll(*this, toBeRemoved); 130 WTF::removeAll(*this, toBeRemoved);
131 } 131 }
132 132
133 ValueType take(iterator); 133 ValueType take(iterator);
134 ValueType take(ValuePeekInType); 134 ValueType take(ValuePeekInType);
135 ValueType takeAny(); 135 ValueType takeAny();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 .template addPassingHashCode<HashSetTranslatorAdapter<HashTranslator>>( 273 .template addPassingHashCode<HashSetTranslatorAdapter<HashTranslator>>(
274 std::forward<T>(value), value); 274 std::forward<T>(value), value);
275 } 275 }
276 276
277 template <typename T, typename U, typename V, typename W> 277 template <typename T, typename U, typename V, typename W>
278 inline void HashSet<T, U, V, W>::remove(iterator it) { 278 inline void HashSet<T, U, V, W>::remove(iterator it) {
279 m_impl.remove(it.m_impl); 279 m_impl.remove(it.m_impl);
280 } 280 }
281 281
282 template <typename T, typename U, typename V, typename W> 282 template <typename T, typename U, typename V, typename W>
283 inline void HashSet<T, U, V, W>::remove(ValuePeekInType value) { 283 inline void HashSet<T, U, V, W>::erase(ValuePeekInType value) {
284 remove(find(value)); 284 remove(find(value));
285 } 285 }
286 286
287 template <typename T, typename U, typename V, typename W> 287 template <typename T, typename U, typename V, typename W>
288 inline void HashSet<T, U, V, W>::clear() { 288 inline void HashSet<T, U, V, W>::clear() {
289 m_impl.clear(); 289 m_impl.clear();
290 } 290 }
291 291
292 template <typename T, typename U, typename V, typename W> 292 template <typename T, typename U, typename V, typename W>
293 inline auto HashSet<T, U, V, W>::take(iterator it) -> ValueType { 293 inline auto HashSet<T, U, V, W>::take(iterator it) -> ValueType {
(...skipping 30 matching lines...) Expand all
324 iterator end = collection.end(); 324 iterator end = collection.end();
325 for (unsigned i = 0; it != end; ++it, ++i) 325 for (unsigned i = 0; it != end; ++it, ++i)
326 vector[i] = *it; 326 vector[i] = *it;
327 } 327 }
328 328
329 } // namespace WTF 329 } // namespace WTF
330 330
331 using WTF::HashSet; 331 using WTF::HashSet;
332 332
333 #endif // WTF_HashSet_h 333 #endif // WTF_HashSet_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/DequeTest.cpp ('k') | third_party/WebKit/Source/wtf/HashSetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698