| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> | 4 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 707 |
| 708 template <typename T, typename U, typename V, typename W> | 708 template <typename T, typename U, typename V, typename W> |
| 709 inline const T& LinkedHashSet<T, U, V, W>::front() const { | 709 inline const T& LinkedHashSet<T, U, V, W>::front() const { |
| 710 DCHECK(!isEmpty()); | 710 DCHECK(!isEmpty()); |
| 711 return firstNode()->m_value; | 711 return firstNode()->m_value; |
| 712 } | 712 } |
| 713 | 713 |
| 714 template <typename T, typename U, typename V, typename W> | 714 template <typename T, typename U, typename V, typename W> |
| 715 inline void LinkedHashSet<T, U, V, W>::removeFirst() { | 715 inline void LinkedHashSet<T, U, V, W>::removeFirst() { |
| 716 DCHECK(!isEmpty()); | 716 DCHECK(!isEmpty()); |
| 717 m_impl.remove(static_cast<Node*>(m_anchor.m_next)); | 717 m_impl.erase(static_cast<Node*>(m_anchor.m_next)); |
| 718 } | 718 } |
| 719 | 719 |
| 720 template <typename T, typename U, typename V, typename W> | 720 template <typename T, typename U, typename V, typename W> |
| 721 inline T& LinkedHashSet<T, U, V, W>::back() { | 721 inline T& LinkedHashSet<T, U, V, W>::back() { |
| 722 DCHECK(!isEmpty()); | 722 DCHECK(!isEmpty()); |
| 723 return lastNode()->m_value; | 723 return lastNode()->m_value; |
| 724 } | 724 } |
| 725 | 725 |
| 726 template <typename T, typename U, typename V, typename W> | 726 template <typename T, typename U, typename V, typename W> |
| 727 inline const T& LinkedHashSet<T, U, V, W>::back() const { | 727 inline const T& LinkedHashSet<T, U, V, W>::back() const { |
| 728 DCHECK(!isEmpty()); | 728 DCHECK(!isEmpty()); |
| 729 return lastNode()->m_value; | 729 return lastNode()->m_value; |
| 730 } | 730 } |
| 731 | 731 |
| 732 template <typename T, typename U, typename V, typename W> | 732 template <typename T, typename U, typename V, typename W> |
| 733 inline void LinkedHashSet<T, U, V, W>::pop_back() { | 733 inline void LinkedHashSet<T, U, V, W>::pop_back() { |
| 734 DCHECK(!isEmpty()); | 734 DCHECK(!isEmpty()); |
| 735 m_impl.remove(static_cast<Node*>(m_anchor.m_prev)); | 735 m_impl.erase(static_cast<Node*>(m_anchor.m_prev)); |
| 736 } | 736 } |
| 737 | 737 |
| 738 template <typename T, typename U, typename V, typename W> | 738 template <typename T, typename U, typename V, typename W> |
| 739 inline typename LinkedHashSet<T, U, V, W>::iterator | 739 inline typename LinkedHashSet<T, U, V, W>::iterator |
| 740 LinkedHashSet<T, U, V, W>::find(ValuePeekInType value) { | 740 LinkedHashSet<T, U, V, W>::find(ValuePeekInType value) { |
| 741 LinkedHashSet::Node* node = | 741 LinkedHashSet::Node* node = |
| 742 m_impl.template lookup<LinkedHashSet::NodeHashFunctions, ValuePeekInType>( | 742 m_impl.template lookup<LinkedHashSet::NodeHashFunctions, ValuePeekInType>( |
| 743 value); | 743 value); |
| 744 if (!node) | 744 if (!node) |
| 745 return end(); | 745 return end(); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 LinkedHashSet<T, U, V, W>::insertBefore(ValuePeekInType beforeValue, | 861 LinkedHashSet<T, U, V, W>::insertBefore(ValuePeekInType beforeValue, |
| 862 IncomingValueType&& newValue) { | 862 IncomingValueType&& newValue) { |
| 863 return insertBefore(find(beforeValue), | 863 return insertBefore(find(beforeValue), |
| 864 std::forward<IncomingValueType>(newValue)); | 864 std::forward<IncomingValueType>(newValue)); |
| 865 } | 865 } |
| 866 | 866 |
| 867 template <typename T, typename U, typename V, typename W> | 867 template <typename T, typename U, typename V, typename W> |
| 868 inline void LinkedHashSet<T, U, V, W>::erase(iterator it) { | 868 inline void LinkedHashSet<T, U, V, W>::erase(iterator it) { |
| 869 if (it == end()) | 869 if (it == end()) |
| 870 return; | 870 return; |
| 871 m_impl.remove(it.getNode()); | 871 m_impl.erase(it.getNode()); |
| 872 } | 872 } |
| 873 | 873 |
| 874 template <typename T, typename U, typename V, typename W> | 874 template <typename T, typename U, typename V, typename W> |
| 875 inline void LinkedHashSet<T, U, V, W>::erase(ValuePeekInType value) { | 875 inline void LinkedHashSet<T, U, V, W>::erase(ValuePeekInType value) { |
| 876 erase(find(value)); | 876 erase(find(value)); |
| 877 } | 877 } |
| 878 | 878 |
| 879 inline void swapAnchor(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) { | 879 inline void swapAnchor(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) { |
| 880 DCHECK(a.m_prev); | 880 DCHECK(a.m_prev); |
| 881 DCHECK(a.m_next); | 881 DCHECK(a.m_next); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 swap(static_cast<Base&>(a), static_cast<Base&>(b)); | 929 swap(static_cast<Base&>(a), static_cast<Base&>(b)); |
| 930 swap(a.m_value, b.m_value); | 930 swap(a.m_value, b.m_value); |
| 931 Allocator::leaveGCForbiddenScope(); | 931 Allocator::leaveGCForbiddenScope(); |
| 932 } | 932 } |
| 933 | 933 |
| 934 } // namespace WTF | 934 } // namespace WTF |
| 935 | 935 |
| 936 using WTF::LinkedHashSet; | 936 using WTF::LinkedHashSet; |
| 937 | 937 |
| 938 #endif /* WTF_LinkedHashSet_h */ | 938 #endif /* WTF_LinkedHashSet_h */ |
| OLD | NEW |