Changeset 28132 in webkit for trunk/JavaScriptCore
- Timestamp:
- Nov 28, 2007, 10:04:21 PM (18 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r28110 r28132 1 2007-11-28 Brady Eidson <[email protected]> 2 3 Reviewed by Geoff 4 5 Add copyKeysToVector utility, mirroring copyValuesToVector 6 Also change the copyValuesToVector implementation to be a little more attractive 7 8 * wtf/HashMap.h: 9 (WTF::copyKeysToVector): 10 (WTF::copyValuesToVector): 11 1 12 2007-11-27 Alp Toker <[email protected]> 2 13 -
trunk/JavaScriptCore/wtf/HashMap.h
r27710 r28132 395 395 396 396 template<typename T, typename U, typename V, typename W, typename X> 397 inline void copy ValuesToVector(const HashMap<T, U, V, W, X>& collection, Vector<U>& vector)398 { 399 typedef typename HashMap<T, U, V, W, X>::const_iterator iterator;397 inline void copyKeysToVector(const HashMap<T, U, V, W, X>& collection, Vector<T>& vector) 398 { 399 typedef typename HashMap<T, U, V, W, X>::const_iterator::Keys iterator; 400 400 401 401 vector.resize(collection.size()); 402 402 403 iterator it = collection.begin() ;404 iterator end = collection.end() ;403 iterator it = collection.begin().keys(); 404 iterator end = collection.end().keys(); 405 405 for (unsigned i = 0; it != end; ++it, ++i) 406 vector[i] = (*it).second; 406 vector[i] = *it; 407 } 408 409 template<typename T, typename U, typename V, typename W, typename X> 410 inline void copyValuesToVector(const HashMap<T, U, V, W, X>& collection, Vector<U>& vector) 411 { 412 typedef typename HashMap<T, U, V, W, X>::const_iterator::Values iterator; 413 414 vector.resize(collection.size()); 415 416 iterator it = collection.begin().values(); 417 iterator end = collection.end().values(); 418 for (unsigned i = 0; it != end; ++it, ++i) 419 vector[i] = *it; 407 420 } 408 421
Note:
See TracChangeset
for help on using the changeset viewer.