Skip to content

Commit fea75ad

Browse files
committed
refactor: Drop boost/algorithm/string/replace.hpp dependency
1 parent 857526e commit fea75ad

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Diff for: src/util/string.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
#include <util/string.h>
66

7-
#include <boost/algorithm/string/replace.hpp>
8-
7+
#include <regex>
98
#include <string>
9+
#include <utility>
1010

11-
void ReplaceAll(std::string& in_out, std::string_view search, std::string_view substitute)
11+
void ReplaceAll(std::string& in_out, const std::string& search, const std::string& substitute)
1212
{
13-
boost::replace_all(in_out, search, substitute);
13+
if (search.empty()) return;
14+
in_out = std::regex_replace(in_out, std::regex(std::move(search)), substitute);
1415
}

Diff for: src/util/string.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <string_view>
1818
#include <vector>
1919

20-
void ReplaceAll(std::string& in_out, std::string_view search, std::string_view substitute);
20+
void ReplaceAll(std::string& in_out, const std::string& search, const std::string& substitute);
2121

2222
[[nodiscard]] inline std::vector<std::string> SplitString(std::string_view str, char sep)
2323
{

Diff for: test/lint/lint-includes.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
"src/minisketch/",
2222
]
2323

24-
EXPECTED_BOOST_INCLUDES = ["boost/algorithm/string/replace.hpp",
25-
"boost/date_time/posix_time/posix_time.hpp",
24+
EXPECTED_BOOST_INCLUDES = ["boost/date_time/posix_time/posix_time.hpp",
2625
"boost/multi_index/hashed_index.hpp",
2726
"boost/multi_index/ordered_index.hpp",
2827
"boost/multi_index/sequenced_index.hpp",

0 commit comments

Comments
 (0)