Replace boost starts_with with std::string
C++20 introduces std::string::starts_with, which provides standard,
efficient, and header-light ways to check string prefixes and
suffixes.
Replacing boost::starts_with reduces Boost dependencies, and improves
compilation performance.
Change-Id: I5f146d9a1abe6d04d95f8228853139eda773218c
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/src/entity_manager/perform_scan.cpp b/src/entity_manager/perform_scan.cpp
index 35430d8..c71fa48 100644
--- a/src/entity_manager/perform_scan.cpp
+++ b/src/entity_manager/perform_scan.cpp
@@ -6,7 +6,6 @@
#include "perform_probe.hpp"
#include "utils.hpp"
-#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/container/flat_set.hpp>
@@ -84,7 +83,7 @@
// Introspectable, and Properties) are returned by
// the mapper but don't have properties, so don't bother
// with the GetAll call to save some cycles.
- if (!boost::algorithm::starts_with(iface, "org.freedesktop"))
+ if (!iface.starts_with("org.freedesktop"))
{
getInterfaces({busname, path, iface}, probeVector, scan,
io);
@@ -292,7 +291,7 @@
nlohmann::json& expose,
const std::string& propertyName)
{
- if (boost::starts_with(propertyName, "Bind"))
+ if (propertyName.starts_with("Bind"))
{
std::string bind = propertyName.substr(sizeof("Bind") - 1);
exposedObject["Status"] = "okay";
@@ -329,7 +328,7 @@
nlohmann::json& systemConfiguration, const std::string& recordName,
nlohmann::json& expose, nlohmann::json::iterator& keyPair)
{
- bool isBind = boost::starts_with(keyPair.key(), "Bind");
+ bool isBind = keyPair.key().starts_with("Bind");
bool isDisable = keyPair.key() == "DisableNode";
bool isExposeAction = isBind || isDisable;