Fix performance-noexcept-swap clang-tidy warning (#6931)

This commit is contained in:
Siarhei Fedartsou 2024-06-07 16:18:10 +02:00 committed by GitHub
parent 523ee762f0
commit c57b0d28b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 7 deletions

View File

@ -59,7 +59,6 @@ Checks: >
modernize-use-using,
performance-*,
-performance-noexcept-move-constructor,
-performance-noexcept-swap,
-performance-no-int-to-ptr,
-performance-enum-size,
-performance-avoid-endl,

View File

@ -24,6 +24,7 @@
- NodeJS:
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
- Misc:
- FIXED: Fix performance-noexcept-swap clang-tidy warning. [#6931](https://github.com/Project-OSRM/osrm-backend/pull/6931)
- CHANGED: Use custom struct instead of std::pair in QueryHeap. [#6921](https://github.com/Project-OSRM/osrm-backend/pull/6921)
- CHANGED: Use std::string_view::starts_with instead of boost::starts_with. [#6918](https://github.com/Project-OSRM/osrm-backend/pull/6918)
- CHANGED: Get rid of boost::math::constants::* and M_PI in favor of std::numbers. [#6916](https://github.com/Project-OSRM/osrm-backend/pull/6916)

View File

@ -166,7 +166,7 @@ class DeallocatingVectorIterator
template <typename ElementT> class DeallocatingVector;
template <typename T> void swap(DeallocatingVector<T> &lhs, DeallocatingVector<T> &rhs);
template <typename T> void swap(DeallocatingVector<T> &lhs, DeallocatingVector<T> &rhs) noexcept;
template <typename ElementT> class DeallocatingVector
{
@ -221,9 +221,10 @@ template <typename ElementT> class DeallocatingVector
~DeallocatingVector() { clear(); }
friend void swap<>(DeallocatingVector<ElementT> &lhs, DeallocatingVector<ElementT> &rhs);
friend void swap<>(DeallocatingVector<ElementT> &lhs,
DeallocatingVector<ElementT> &rhs) noexcept;
void swap(DeallocatingVector<ElementT> &other)
void swap(DeallocatingVector<ElementT> &other) noexcept
{
std::swap(current_size, other.current_size);
bucket_list.swap(other.bucket_list);
@ -342,7 +343,7 @@ template <typename ElementT> class DeallocatingVector
}
};
template <typename T> void swap(DeallocatingVector<T> &lhs, DeallocatingVector<T> &rhs)
template <typename T> void swap(DeallocatingVector<T> &lhs, DeallocatingVector<T> &rhs) noexcept
{
lhs.swap(rhs);
}

View File

@ -10,9 +10,9 @@ namespace osrm::util
namespace permutation_detail
{
template <typename T> static inline void swap(T &a, T &b) { std::swap(a, b); }
template <typename T> static inline void swap(T &a, T &b) noexcept { std::swap(a, b); }
static inline void swap(std::vector<bool>::reference a, std::vector<bool>::reference b)
static inline void swap(std::vector<bool>::reference a, std::vector<bool>::reference b) noexcept
{
std::vector<bool>::swap(a, b);
}