GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::experimental::ostream_joiner(3) C++ Standard Libary std::experimental::ostream_joiner(3)

std::experimental::ostream_joiner - std::experimental::ostream_joiner


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 LegacyOutputIterator 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 operation is performed
when the iterator (whether dereferenced or not) is assigned to. Incrementing 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 member that
indicates whether the next write is for the first element in the sequence.


Compared to std::ostream_iterator, ostream_joiner prints the delimiter sequence one
fewer time, and is not templated on the type of the object to be printed.


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


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 sequence
(public member function)
operator* no-op
(public member function)
operator++ no-op
operator++(int) (public member function)


creates a ostream_joiner object, deducing the template's type
make_ostream_joiner arguments from the function arguments
(function template)

// 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, ", "));
}


1, 2, 3, 4, 5


ostreambuf_iterator output iterator that writes to std::basic_streambuf
(class template)
ostream_iterator output iterator that writes to std::basic_ostream
(class template)
istream_iterator input iterator that reads from std::basic_istream
(class template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.