| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 { | 700 { |
| 701 swap(other); | 701 swap(other); |
| 702 return *this; | 702 return *this; |
| 703 } | 703 } |
| 704 #endif | 704 #endif |
| 705 | 705 |
| 706 template<typename T, size_t inlineCapacity> | 706 template<typename T, size_t inlineCapacity> |
| 707 template<typename U> | 707 template<typename U> |
| 708 bool Vector<T, inlineCapacity>::contains(const U& value) const | 708 bool Vector<T, inlineCapacity>::contains(const U& value) const |
| 709 { | 709 { |
| 710 return find(value) != notFound; | 710 return find(value) != kNotFound; |
| 711 } | 711 } |
| 712 | 712 |
| 713 template<typename T, size_t inlineCapacity> | 713 template<typename T, size_t inlineCapacity> |
| 714 template<typename U> | 714 template<typename U> |
| 715 size_t Vector<T, inlineCapacity>::find(const U& value) const | 715 size_t Vector<T, inlineCapacity>::find(const U& value) const |
| 716 { | 716 { |
| 717 const T* b = begin(); | 717 const T* b = begin(); |
| 718 const T* e = end(); | 718 const T* e = end(); |
| 719 for (const T* iter = b; iter < e; ++iter) { | 719 for (const T* iter = b; iter < e; ++iter) { |
| 720 if (*iter == value) | 720 if (*iter == value) |
| 721 return iter - b; | 721 return iter - b; |
| 722 } | 722 } |
| 723 return notFound; | 723 return kNotFound; |
| 724 } | 724 } |
| 725 | 725 |
| 726 template<typename T, size_t inlineCapacity> | 726 template<typename T, size_t inlineCapacity> |
| 727 template<typename U> | 727 template<typename U> |
| 728 size_t Vector<T, inlineCapacity>::reverseFind(const U& value) const | 728 size_t Vector<T, inlineCapacity>::reverseFind(const U& value) const |
| 729 { | 729 { |
| 730 const T* b = begin(); | 730 const T* b = begin(); |
| 731 const T* iter = end(); | 731 const T* iter = end(); |
| 732 while (iter > b) { | 732 while (iter > b) { |
| 733 --iter; | 733 --iter; |
| 734 if (*iter == value) | 734 if (*iter == value) |
| 735 return iter - b; | 735 return iter - b; |
| 736 } | 736 } |
| 737 return notFound; | 737 return kNotFound; |
| 738 } | 738 } |
| 739 | 739 |
| 740 template<typename T, size_t inlineCapacity> | 740 template<typename T, size_t inlineCapacity> |
| 741 void Vector<T, inlineCapacity>::fill(const T& val, size_t newSize) | 741 void Vector<T, inlineCapacity>::fill(const T& val, size_t newSize) |
| 742 { | 742 { |
| 743 if (size() > newSize) | 743 if (size() > newSize) |
| 744 shrink(newSize); | 744 shrink(newSize); |
| 745 else if (newSize > capacity()) { | 745 else if (newSize > capacity()) { |
| 746 clear(); | 746 clear(); |
| 747 reserveCapacity(newSize); | 747 reserveCapacity(newSize); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 inline bool operator!=(const Vector<T, inlineCapacity>& a, const Vector<T, i
nlineCapacity>& b) | 1065 inline bool operator!=(const Vector<T, inlineCapacity>& a, const Vector<T, i
nlineCapacity>& b) |
| 1066 { | 1066 { |
| 1067 return !(a == b); | 1067 return !(a == b); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 } // namespace WTF | 1070 } // namespace WTF |
| 1071 | 1071 |
| 1072 using WTF::Vector; | 1072 using WTF::Vector; |
| 1073 | 1073 |
| 1074 #endif // WTF_Vector_h | 1074 #endif // WTF_Vector_h |
| OLD | NEW |