join(delimiter, container.begin(), container.end(), output);
}
+template <class Delim, class Value, class String>
+void join(const Delim& delimiter,
+ const std::initializer_list<Value>& values,
+ String& output) {
+ join(delimiter, values.begin(), values.end(), output);
+}
+
template <class Delim, class Container>
std::string join(const Delim& delimiter,
const Container& container) {
return output;
}
+template <class Delim, class Value>
+std::string join(const Delim& delimiter,
+ const std::initializer_list<Value>& values) {
+ std::string output;
+ join(delimiter, values.begin(), values.end(), output);
+ return output;
+}
+
} // namespace folly
// Hash functions for string and fbstring usable with e.g. hash_map
auto input3 = { 'f', 'a', 'c', 'e', 'b', 'o', 'o', 'k' };
join("", input3, output);
EXPECT_EQ(output, "facebook");
+
+ join("_", { "", "f", "a", "c", "e", "b", "o", "o", "k", "" }, output);
+ EXPECT_EQ(output, "_f_a_c_e_b_o_o_k_");
}
TEST(String, hexlify) {