OLD | NEW |
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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 template <typename IncomingKeyType, typename IncomingMappedType> | 491 template <typename IncomingKeyType, typename IncomingMappedType> |
492 typename HashMap<T, U, V, W, X, Y>::AddResult HashMap<T, U, V, W, X, Y>::set( | 492 typename HashMap<T, U, V, W, X, Y>::AddResult HashMap<T, U, V, W, X, Y>::set( |
493 IncomingKeyType&& key, | 493 IncomingKeyType&& key, |
494 IncomingMappedType&& mapped) { | 494 IncomingMappedType&& mapped) { |
495 AddResult result = inlineAdd(std::forward<IncomingKeyType>(key), | 495 AddResult result = inlineAdd(std::forward<IncomingKeyType>(key), |
496 std::forward<IncomingMappedType>(mapped)); | 496 std::forward<IncomingMappedType>(mapped)); |
497 if (!result.isNewEntry) { | 497 if (!result.isNewEntry) { |
498 // The inlineAdd call above found an existing hash table entry; we need | 498 // The inlineAdd call above found an existing hash table entry; we need |
499 // to set the mapped value. | 499 // to set the mapped value. |
500 // | 500 // |
501 // It's safe to call std::forward again, because |mapped| isn't moved if the
re's an existing entry. | 501 // It's safe to call std::forward again, because |mapped| isn't moved if |
| 502 // there's an existing entry. |
502 MappedTraits::store(std::forward<IncomingMappedType>(mapped), | 503 MappedTraits::store(std::forward<IncomingMappedType>(mapped), |
503 result.storedValue->value); | 504 result.storedValue->value); |
504 } | 505 } |
505 return result; | 506 return result; |
506 } | 507 } |
507 | 508 |
508 template <typename T, | 509 template <typename T, |
509 typename U, | 510 typename U, |
510 typename V, | 511 typename V, |
511 typename W, | 512 typename W, |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 iterator end = collection.end().values(); | 690 iterator end = collection.end().values(); |
690 for (unsigned i = 0; it != end; ++it, ++i) | 691 for (unsigned i = 0; it != end; ++it, ++i) |
691 vector[i] = *it; | 692 vector[i] = *it; |
692 } | 693 } |
693 | 694 |
694 } // namespace WTF | 695 } // namespace WTF |
695 | 696 |
696 using WTF::HashMap; | 697 using WTF::HashMap; |
697 | 698 |
698 #endif // WTF_HashMap_h | 699 #endif // WTF_HashMap_h |
OLD | NEW |