12template<
typename Collection,
typename Separator>
16 Joiner(Collection&& col_, Separator&& sep_)
17 : col(
std::forward<Collection>(col_))
18 , sep(
std::forward<Separator>(sep_))
24 return joiner.execute(os);
27 [[nodiscard]]
operator std::string()
const
29 std::ostringstream os;
35 template<
typename OutputStream>
36 OutputStream& execute(OutputStream& os)
const
38 auto first = std::begin(col);
39 auto last = std::end (col);
42 while (first != last) {
59template<
typename Collection,
typename Separator>
62 return { std::forward<Collection>(col), std::forward<Separator>(sep) };
friend std::ostream & operator<<(std::ostream &os, const Joiner &joiner)
Joiner(Collection &&col_, Separator &&sep_)
detail::Joiner< Collection, Separator > join(Collection &&col, Separator &&sep)