Skip to content

Commit faf8da3

Browse files
author
MacroFake
committed
Remove Join() helper only used in tests
Also remove redundant return type that can be deduced by the compiler.
1 parent 9eaef10 commit faf8da3

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/test/util_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ BOOST_AUTO_TEST_CASE(span_write_bytes)
238238
BOOST_AUTO_TEST_CASE(util_Join)
239239
{
240240
// Normal version
241-
BOOST_CHECK_EQUAL(Join({}, ", "), "");
242-
BOOST_CHECK_EQUAL(Join({"foo"}, ", "), "foo");
243-
BOOST_CHECK_EQUAL(Join({"foo", "bar"}, ", "), "foo, bar");
241+
BOOST_CHECK_EQUAL(Join(std::vector<std::string>{}, ", "), "");
242+
BOOST_CHECK_EQUAL(Join(std::vector<std::string>{"foo"}, ", "), "foo");
243+
BOOST_CHECK_EQUAL(Join(std::vector<std::string>{"foo", "bar"}, ", "), "foo, bar");
244244

245245
// Version with unary operator
246246
const auto op_upper = [](const std::string& s) { return ToUpper(s); };

src/util/string.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ void ReplaceAll(std::string& in_out, const std::string& search, const std::strin
6666
*/
6767
template <typename T, typename BaseType, typename UnaryOp>
6868
auto Join(const std::vector<T>& list, const BaseType& separator, UnaryOp unary_op)
69-
-> decltype(unary_op(list.at(0)))
7069
{
7170
decltype(unary_op(list.at(0))) ret;
7271
for (size_t i = 0; i < list.size(); ++i) {
@@ -82,12 +81,6 @@ T Join(const std::vector<T>& list, const T2& separator)
8281
return Join(list, separator, [](const T& i) { return i; });
8382
}
8483

85-
// Explicit overload needed for c_str arguments, which would otherwise cause a substitution failure in the template above.
86-
inline std::string Join(const std::vector<std::string>& list, std::string_view separator)
87-
{
88-
return Join<std::string>(list, separator);
89-
}
90-
9184
/**
9285
* Create an unordered multi-line list of items.
9386
*/

0 commit comments

Comments
 (0)