diff --git a/Subtrees/beast/modules/beast_core/containers/beast_Array.h b/Subtrees/beast/modules/beast_core/containers/beast_Array.h index 74f800068..6feb2fdc1 100644 --- a/Subtrees/beast/modules/beast_core/containers/beast_Array.h +++ b/Subtrees/beast/modules/beast_core/containers/beast_Array.h @@ -132,7 +132,7 @@ public: if (this != &other) { Array otherCopy (other); - swapWithArray (otherCopy); + swapWith (otherCopy); } return *this; @@ -577,7 +577,7 @@ public: because it just swaps their internal pointers. */ template - void swapWithArray (OtherArrayType& otherArray) noexcept + void swapWith (OtherArrayType& otherArray) noexcept { const ScopedLockType lock1 (getLock()); const typename OtherArrayType::ScopedLockType lock2 (otherArray.getLock()); diff --git a/Subtrees/beast/modules/beast_core/containers/beast_HashMap.h b/Subtrees/beast/modules/beast_core/containers/beast_HashMap.h index 7619e3dc5..ce467371d 100644 --- a/Subtrees/beast/modules/beast_core/containers/beast_HashMap.h +++ b/Subtrees/beast/modules/beast_core/containers/beast_HashMap.h @@ -354,12 +354,13 @@ public: //============================================================================== /** Efficiently swaps the contents of two hash-maps. */ - void swapWith (HashMap& otherHashMap) noexcept + template + void swapWith (OtherHashMapType& otherHashMap) noexcept { const ScopedLockType lock1 (getLock()); - const ScopedLockType lock2 (otherHashMap.getLock()); + const typename OtherHashMapType::ScopedLockType lock2 (otherHashMap.getLock()); - slots.swapWithArray (otherHashMap.slots); + slots.swapWith (otherHashMap.slots); std::swap (totalNumItems, otherHashMap.totalNumItems); } diff --git a/Subtrees/beast/modules/beast_core/containers/beast_OwnedArray.h b/Subtrees/beast/modules/beast_core/containers/beast_OwnedArray.h index 022188ec1..9049bf010 100644 --- a/Subtrees/beast/modules/beast_core/containers/beast_OwnedArray.h +++ b/Subtrees/beast/modules/beast_core/containers/beast_OwnedArray.h @@ -788,10 +788,11 @@ public: If you need to exchange two arrays, this is vastly quicker than using copy-by-value because it just swaps their internal pointers. */ - void swapWithArray (OwnedArray& otherArray) noexcept + template + void swapWith (OtherArrayType& otherArray) noexcept { const ScopedLockType lock1 (getLock()); - const ScopedLockType lock2 (otherArray.getLock()); + const typename OtherArrayType::ScopedLockType lock2 (otherArray.getLock()); data.swapWith (otherArray.data); std::swap (numUsed, otherArray.numUsed); diff --git a/Subtrees/beast/modules/beast_core/containers/beast_SharedObjectArray.h b/Subtrees/beast/modules/beast_core/containers/beast_SharedObjectArray.h index 0b775ed77..e79bf53a0 100644 --- a/Subtrees/beast/modules/beast_core/containers/beast_SharedObjectArray.h +++ b/Subtrees/beast/modules/beast_core/containers/beast_SharedObjectArray.h @@ -91,7 +91,7 @@ public: SharedObjectArray& operator= (const SharedObjectArray& other) noexcept { SharedObjectArray otherCopy (other); - swapWithArray (otherCopy); + swapWith (otherCopy); return *this; } @@ -102,7 +102,7 @@ public: SharedObjectArray& operator= (const SharedObjectArray& other) noexcept { SharedObjectArray otherCopy (other); - swapWithArray (otherCopy); + swapWith (otherCopy); return *this; } @@ -741,7 +741,7 @@ public: because it just swaps their internal pointers. */ template - void swapWithArray (OtherArrayType& otherArray) noexcept + void swapWith (OtherArrayType& otherArray) noexcept { const ScopedLockType lock1 (getLock()); const typename OtherArrayType::ScopedLockType lock2 (otherArray.getLock()); diff --git a/Subtrees/beast/modules/beast_core/containers/beast_SortedSet.h b/Subtrees/beast/modules/beast_core/containers/beast_SortedSet.h index 0af215fff..3227892ca 100644 --- a/Subtrees/beast/modules/beast_core/containers/beast_SortedSet.h +++ b/Subtrees/beast/modules/beast_core/containers/beast_SortedSet.h @@ -443,9 +443,10 @@ public: If you need to exchange two arrays, this is vastly quicker than using copy-by-value because it just swaps their internal pointers. */ - void swapWith (SortedSet& otherSet) noexcept + template + void swapWith (OtherSortedSetType& otherSet) noexcept { - data.swapWithArray (otherSet.data); + data.swapWith (otherSet.data); } //============================================================================== diff --git a/Subtrees/beast/modules/beast_core/text/beast_StringArray.cpp b/Subtrees/beast/modules/beast_core/text/beast_StringArray.cpp index 26a7a2ef7..98d34ffd9 100644 --- a/Subtrees/beast/modules/beast_core/text/beast_StringArray.cpp +++ b/Subtrees/beast/modules/beast_core/text/beast_StringArray.cpp @@ -122,7 +122,7 @@ bool StringArray::operator!= (const StringArray& other) const noexcept void StringArray::swapWith (StringArray& other) noexcept { - strings.swapWithArray (other.strings); + strings.swapWith (other.strings); } void StringArray::clear() diff --git a/modules/ripple_core/validator/ripple_Validator.h b/modules/ripple_core/validator/ripple_Validator.h index 522ad1c6b..d8f1a2133 100644 --- a/modules/ripple_core/validator/ripple_Validator.h +++ b/modules/ripple_core/validator/ripple_Validator.h @@ -70,7 +70,7 @@ public: explicit List (SharedObjectArray & list) { - m_list.swapWithArray (list); + m_list.swapWith (list); } ~List () diff --git a/modules/ripple_core/validator/ripple_Validators.cpp b/modules/ripple_core/validator/ripple_Validators.cpp index 35545f4a2..acea75a22 100644 --- a/modules/ripple_core/validator/ripple_Validators.cpp +++ b/modules/ripple_core/validator/ripple_Validators.cpp @@ -167,7 +167,7 @@ public: sorted.addSorted (compare, arrayToSort [i]); } - arrayToSort.swapWithArray (sorted); + arrayToSort.swapWith (sorted); } // Given the old list and the new list for a source, this