std::experimental::make_ostream_joiner (3) - Linux Man Pages

std::experimental::make_ostream_joiner: std::experimental::make_ostream_joiner

NAME

std::experimental::make_ostream_joiner - std::experimental::make_ostream_joiner

Synopsis


Defined in header <experimental/iterator>
template <class charT, class traits, class DelimT>
std::experimental::ostream_joiner<std::decay_t<DelimT>, charT, traits> (library fundamentals TS v2)
make_ostream_joiner(std::basic_ostream<charT, traits>& os, DelimT&& delimiter);


Creates an ostream_joiner object, deducing the template arguments from the types of the function arguments.

Parameters


os - the basic_ostream object that the iterator is to be associated to
delimiter - the delimiter

Return value


A ostream_joiner object, created as if by std::experimental::ostream_joiner<std::decay_t<DelimT>, charT, traits>(os, std::forward<DelimT>(delimiter)).

Example


// Run this code


  #include <experimental/iterator>
  #include <iostream>
  #include <vector>


  int main() {
      std::vector<int> x{1, 2, 3, 4};
      std::copy(x.begin(), x.end(),
                std::experimental::make_ostream_joiner(std::cout, ", "));
  }

Output:


  1, 2, 3, 4