Commit 2bfec0de authored by Philip Pronin's avatar Philip Pronin Committed by Tudor Bosman

one more folly::join overload

Summary: To allow codemod changes.

Test Plan: ran test

Reviewed By: tudorb@fb.com

FB internal diff: D549516
parent 43c97295
......@@ -353,6 +353,14 @@ void join(const Delim& delimiter,
join(delimiter, container.begin(), container.end(), output);
}
template <class Delim, class Container>
std::string join(const Delim& delimiter,
const Container& container) {
std::string output;
join(delimiter, container.begin(), container.end(), output);
return output;
}
} // namespace folly
// Hash functions for string and fbstring usable with e.g. hash_map
......
......@@ -644,10 +644,14 @@ TEST(String, join) {
std::vector<std::string> input1 = { "1", "23", "456", "" };
join(':', input1, output);
EXPECT_EQ(output, "1:23:456:");
output = join(':', input1);
EXPECT_EQ(output, "1:23:456:");
auto input2 = { 1, 23, 456 };
join("-*-", input2, output);
EXPECT_EQ(output, "1-*-23-*-456");
output = join("-*-", input2);
EXPECT_EQ(output, "1-*-23-*-456");
auto input3 = { 'f', 'a', 'c', 'e', 'b', 'o', 'o', 'k' };
join("", input3, output);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment