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/chassis.hpp b/redfish-core/lib/chassis.hpp
index 397e31c..969973f 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -34,6 +34,7 @@
#include <sdbusplus/unpack_properties.hpp>
#include <array>
+#include <ranges>
#include <string_view>
namespace redfish
@@ -514,8 +515,8 @@
for (const char* interface : hasIndicatorLed)
{
- if (std::find(interfaces2.begin(), interfaces2.end(),
- interface) != interfaces2.end())
+ if (std::ranges::find(interfaces2, interface) !=
+ interfaces2.end())
{
getIndicatorLedState(asyncResp);
getLocationIndicatorActive(asyncResp);
@@ -728,8 +729,8 @@
bool indicatorChassis = false;
for (const char* interface : hasIndicatorLed)
{
- if (std::find(interfaces3.begin(), interfaces3.end(),
- interface) != interfaces3.end())
+ if (std::ranges::find(interfaces3, interface) !=
+ interfaces3.end())
{
indicatorChassis = true;
break;
@@ -840,8 +841,7 @@
std::string objectPath = "/xyz/openbmc_project/state/chassis_system0";
/* Look for system reset chassis path */
- if ((std::find(chassisList.begin(), chassisList.end(), objectPath)) ==
- chassisList.end())
+ if ((std::ranges::find(chassisList, objectPath)) == chassisList.end())
{
/* We prefer to reset the full chassis_system, but if it doesn't
* exist on some platforms, fall back to a host-only power reset