diff --git a/include/nlohmann/ordered_map.hpp b/include/nlohmann/ordered_map.hpp index 0579fa922..5d28cdf20 100644 --- a/include/nlohmann/ordered_map.hpp +++ b/include/nlohmann/ordered_map.hpp @@ -118,11 +118,11 @@ template , template::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 , template::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 , template::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 , template::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 , template::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; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 30e7f88aa..ddd3131dc 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -19036,11 +19036,11 @@ template , template::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 , template::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 , template::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 , template::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 , template::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; } diff --git a/tests/src/unit-algorithms.cpp b/tests/src/unit-algorithms.cpp index f4b87f8fa..d5a997075 100644 --- a/tests/src/unit-algorithms.cpp +++ b/tests/src/unit-algorithms.cpp @@ -8,6 +8,7 @@ #include "doctest_compatibility.h" +#include #include using nlohmann::json;