Changeset 27385 in webkit for trunk/JavaScriptCore/wtf
- Timestamp:
- Nov 2, 2007, 5:30:44 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/HashMap.h
r27176 r27385 1 1 // -*- mode: c++; c-basic-offset: 4 -*- 2 2 /* 3 * This file is part of the KDE libraries 4 * 5 * Copyright (C) 2005, 2006 Apple Computer, Inc. 3 * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. 6 4 * 7 5 * This library is free software; you can redistribute it and/or … … 98 96 99 97 void remove(const KeyType&); 100 void remove(iterator it);98 void remove(iterator); 101 99 void clear(); 100 101 MappedType take(const KeyType&); // efficient combination of get with remove 102 102 103 103 private: … … 325 325 } 326 326 327 template<typename T, typename U, typename V, typename W, typename MappedTraits> 328 typename HashMap<T, U, V, W, MappedTraits>::MappedType 329 HashMap<T, U, V, W, MappedTraits>::take(const KeyType& key) 330 { 331 // This can probably be made more efficient to avoid ref/deref churn. 332 iterator it = find(key); 333 if (it == end()) 334 return MappedTraits::emptyValue(); 335 typename HashMap<T, U, V, W, MappedTraits>::MappedType result = it->second; 336 remove(it); 337 return result; 338 } 339 327 340 template<typename T, typename U, typename V, typename W, typename X> 328 341 bool operator==(const HashMap<T, U, V, W, X>& a, const HashMap<T, U, V, W, X>& b)
Note:
See TracChangeset
for help on using the changeset viewer.