Use ranges
C++20 brought us std::ranges for a lot of algorithms. Most of these
conversions were done using comby, similar to:
```
comby -verbose 'std::lower_bound(:[a].begin(),:[b].end(),:[c])' 'std::ranges::lower_bound(:[a], :[c])' $(git ls-files | grep "\.[hc]\(pp\)\?$") -in-place
```
Change-Id: I0c99c04e9368312555c08147d474ca93a5959e8d
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 873f882..e09a125 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -37,6 +37,7 @@
#include <array>
#include <limits>
+#include <ranges>
#include <string_view>
namespace redfish
@@ -814,10 +815,9 @@
// (e.g. /redfish/../Processors/dimm0)
for (const auto& [serviceName, interfaceList] : serviceMap)
{
- if (std::find_first_of(
- interfaceList.begin(), interfaceList.end(),
- processorInterfaces.begin(),
- processorInterfaces.end()) != interfaceList.end())
+ if (std::ranges::find_first_of(interfaceList,
+ processorInterfaces) !=
+ std::end(interfaceList))
{
found = true;
break;
@@ -1083,9 +1083,9 @@
const std::string* controlService = nullptr;
for (const auto& [serviceName, interfaceList] : serviceMap)
{
- if (std::find(interfaceList.begin(), interfaceList.end(),
- "xyz.openbmc_project.Control.Processor."
- "CurrentOperatingConfig") != interfaceList.end())
+ if (std::ranges::find(interfaceList,
+ "xyz.openbmc_project.Control.Processor."
+ "CurrentOperatingConfig") != interfaceList.end())
{
controlService = &serviceName;
break;