Replace boost starts_with/ends_with with std::string
C++20 introduces std::string::starts_with and std::string::ends_with,
which provide standard, efficient, and header-light ways to check
string prefixes and suffixes. Replacing boost::algorithm::starts_with
and boost::algorithm::ends_with reduces Boost dependencies,
simplifies includes, and improves compilation performance.
Change-Id: I611ccb49a174dcd5433c1001cf1750907dd023ac
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/dbus-sdr/sdrutils.cpp b/dbus-sdr/sdrutils.cpp
index 7bfa1ed..0fd14c9 100644
--- a/dbus-sdr/sdrutils.cpp
+++ b/dbus-sdr/sdrutils.cpp
@@ -185,8 +185,8 @@
for (const auto& sensor : ipmi::sensor::sensors)
{
// Threshold sensors should not be emplaced in here.
- if (boost::starts_with(sensor.second.sensorPath,
- "/xyz/openbmc_project/sensors/"))
+ if (sensor.second.sensorPath.starts_with(
+ "/xyz/openbmc_project/sensors/"))
{
continue;
}
@@ -493,8 +493,7 @@
for (const auto& entry : entityManagerService->second)
{
- if (boost::algorithm::starts_with(entry,
- "xyz.openbmc_project.Configuration."))
+ if (entry.starts_with("xyz.openbmc_project.Configuration."))
{
return &entry;
}