mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 12:22:39 -03:00
Remove Join() helper only used in tests
Also remove redundant return type that can be deduced by the compiler.
This commit is contained in:
parent
9eaef10801
commit
faf8da3c8d
2 changed files with 3 additions and 10 deletions
|
@ -238,9 +238,9 @@ BOOST_AUTO_TEST_CASE(span_write_bytes)
|
|||
BOOST_AUTO_TEST_CASE(util_Join)
|
||||
{
|
||||
// Normal version
|
||||
BOOST_CHECK_EQUAL(Join({}, ", "), "");
|
||||
BOOST_CHECK_EQUAL(Join({"foo"}, ", "), "foo");
|
||||
BOOST_CHECK_EQUAL(Join({"foo", "bar"}, ", "), "foo, bar");
|
||||
BOOST_CHECK_EQUAL(Join(std::vector<std::string>{}, ", "), "");
|
||||
BOOST_CHECK_EQUAL(Join(std::vector<std::string>{"foo"}, ", "), "foo");
|
||||
BOOST_CHECK_EQUAL(Join(std::vector<std::string>{"foo", "bar"}, ", "), "foo, bar");
|
||||
|
||||
// Version with unary operator
|
||||
const auto op_upper = [](const std::string& s) { return ToUpper(s); };
|
||||
|
|
|
@ -66,7 +66,6 @@ void ReplaceAll(std::string& in_out, const std::string& search, const std::strin
|
|||
*/
|
||||
template <typename T, typename BaseType, typename UnaryOp>
|
||||
auto Join(const std::vector<T>& list, const BaseType& separator, UnaryOp unary_op)
|
||||
-> decltype(unary_op(list.at(0)))
|
||||
{
|
||||
decltype(unary_op(list.at(0))) ret;
|
||||
for (size_t i = 0; i < list.size(); ++i) {
|
||||
|
@ -82,12 +81,6 @@ T Join(const std::vector<T>& list, const T2& separator)
|
|||
return Join(list, separator, [](const T& i) { return i; });
|
||||
}
|
||||
|
||||
// Explicit overload needed for c_str arguments, which would otherwise cause a substitution failure in the template above.
|
||||
inline std::string Join(const std::vector<std::string>& list, std::string_view separator)
|
||||
{
|
||||
return Join<std::string>(list, separator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an unordered multi-line list of items.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue