💚 fix Clang-Tidy warnings

This commit is contained in:
Niels Lohmann 2023-06-07 20:59:11 +02:00
parent 35ede50cfd
commit 0577d5a760
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
3 changed files with 21 additions and 20 deletions

View File

@ -118,11 +118,11 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<class KeyType, detail::enable_if_t<
detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
T & at(KeyType && key)
T & at(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (m_compare(it->first, key)) // NOLINT(cppcoreguidelines-missing-std-forward)
if (m_compare(it->first, key))
{
return it->second;
}
@ -146,11 +146,11 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<class KeyType, detail::enable_if_t<
detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
const T & at(KeyType && key) const
const T & at(KeyType && key) const // NOLINT(cppcoreguidelines-missing-std-forward)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (m_compare(it->first, key)) // NOLINT(cppcoreguidelines-missing-std-forward)
if (m_compare(it->first, key))
{
return it->second;
}
@ -180,11 +180,11 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<class KeyType, detail::enable_if_t<
detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
size_type erase(KeyType && key)
size_type erase(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (m_compare(it->first, key)) // NOLINT(cppcoreguidelines-missing-std-forward)
if (m_compare(it->first, key))
{
// Since we cannot move const Keys, re-construct them in place
for (auto next = it; ++next != this->end(); ++it)
@ -271,11 +271,11 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<class KeyType, detail::enable_if_t<
detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
size_type count(KeyType && key) const
size_type count(KeyType && key) const // NOLINT(cppcoreguidelines-missing-std-forward)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (m_compare(it->first, key))// NOLINT(cppcoreguidelines-missing-std-forward)
if (m_compare(it->first, key))
{
return 1;
}
@ -297,11 +297,11 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<class KeyType, detail::enable_if_t<
detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
iterator find(KeyType && key)
iterator find(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (m_compare(it->first, key)) // NOLINT(cppcoreguidelines-missing-std-forward)
if (m_compare(it->first, key))
{
return it;
}

View File

@ -19036,11 +19036,11 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<class KeyType, detail::enable_if_t<
detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
T & at(KeyType && key)
T & at(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (m_compare(it->first, key)) // NOLINT(cppcoreguidelines-missing-std-forward)
if (m_compare(it->first, key))
{
return it->second;
}
@ -19064,11 +19064,11 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<class KeyType, detail::enable_if_t<
detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
const T & at(KeyType && key) const
const T & at(KeyType && key) const // NOLINT(cppcoreguidelines-missing-std-forward)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (m_compare(it->first, key)) // NOLINT(cppcoreguidelines-missing-std-forward)
if (m_compare(it->first, key))
{
return it->second;
}
@ -19098,11 +19098,11 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<class KeyType, detail::enable_if_t<
detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
size_type erase(KeyType && key)
size_type erase(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (m_compare(it->first, key)) // NOLINT(cppcoreguidelines-missing-std-forward)
if (m_compare(it->first, key))
{
// Since we cannot move const Keys, re-construct them in place
for (auto next = it; ++next != this->end(); ++it)
@ -19189,11 +19189,11 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<class KeyType, detail::enable_if_t<
detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
size_type count(KeyType && key) const
size_type count(KeyType && key) const // NOLINT(cppcoreguidelines-missing-std-forward)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (m_compare(it->first, key))// NOLINT(cppcoreguidelines-missing-std-forward)
if (m_compare(it->first, key))
{
return 1;
}
@ -19215,11 +19215,11 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
template<class KeyType, detail::enable_if_t<
detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
iterator find(KeyType && key)
iterator find(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward)
{
for (auto it = this->begin(); it != this->end(); ++it)
{
if (m_compare(it->first, key)) // NOLINT(cppcoreguidelines-missing-std-forward)
if (m_compare(it->first, key))
{
return it;
}

View File

@ -8,6 +8,7 @@
#include "doctest_compatibility.h"
#include <algorithm>
#include <nlohmann/json.hpp>
using nlohmann::json;