FreeBSD Manual Pages
std::experi...tream_joiner(3) C++ Standard Libarystd::experi...tream_joiner(3) NAME std::experimental::ostream_joiner - std::experimental::ostream_joiner Synopsis Defined in header <experimental/iterator> template< class DelimT, class CharT = char, (library fundamentals TS v2) class Traits = std::char_traits<CharT>> class ostream_joiner; std::experimental::ostream_joiner is a single-pass LegacyOutputIter- ator that writes successive objects into the std::basic_ostream object for which it was constructed, using operator<<, separated by a delimiter. The delimiter is written to the output stream between every two objects that are written. The write opera- tion is performed when the iterator (whether dereferenced or not) is assigned to. In- crementing the ostream_joiner is a no-op. In a typical implementation, the only data members of ostream_joiner are a pointer to the associated std::basic_ostream, the delimiter, and a bool mem- ber that indicates whether the next write is for the first element in the se- quence. Compared to std::ostream_iterator, ostream_joiner prints the delim- iter sequence one fewer time, and is not templated on the type of the object to be printed. Member types Member type Definition char_type CharT traits_type Traits ostream_type std::basic_ostream<CharT, Traits> value_type void difference_type void pointer void reference void iterator_category std::output_iterator_tag Member functions constructor constructs a new ostream_joiner (public member function) destructor destructs an ostream_joiner (implicitly declared) (public member function) operator= writes a object to the associated output se- quence (public member function) operator* no-op (public member function) operator++ no-op operator++(int) (public member function) Non-member functions creates a ostream_joiner object, deducing the template's type make_ostream_joiner arguments from the function arguments (function template) Example // Run this code #include <algorithm> #include <experimental/iterator> #include <iostream> #include <iterator> int main() { int i[] = {1, 2, 3, 4, 5}; std::copy(std::begin(i), std::end(i), std::experimental::make_ostream_joiner(std::cout, ", ")); } Output: 1, 2, 3, 4, 5 See also ostreambuf_iterator output iterator that writes to std::ba- sic_streambuf (class template) ostream_iterator output iterator that writes to std::basic_os- tream (class template) istream_iterator input iterator that reads from std::ba- sic_istream (class template) http://cppreference.com 2022.07.31 std::experi...tream_joiner(3)
NAME | Synopsis | Member types | Member functions | Non-member functions | Example | Output: | See also
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::experimental::ostream_joiner&sektion=3&manpath=FreeBSD+Ports+15.0>
