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::ostream_iterator::ostream_iterator(3) C++ Standard Libary std::ostream_iterator::ostream_iterator(3)

std::ostream_iterator::ostream_iterator - std::ostream_iterator::ostream_iterator


ostream_iterator( ostream_type& stream, const CharT* delim ); (1)
ostream_iterator( ostream_type& stream ); (2)


1) Constructs the iterator with stream as the associated stream and delim as the
delimiter.
2) Constructs the iterator with stream as the associated stream and a null pointer
as the delimiter.


stream - the output stream to be accessed by this iterator
delim - the null-terminated character string to be inserted into the stream after
each output

// Run this code


#include <iostream>
#include <iterator>
#include <algorithm>
#include <numeric>
int main()
{
std::ostream_iterator<char> oo {std::cout};
std::ostream_iterator<int> i1 {std::cout, ", "};
std::fill_n(i1, 5, -1);
*oo++ = '\n';


std::ostream_iterator<double> i2 {std::cout, "; "};
*i2++ = 3.14;
*i2++ = 2.71;
*oo++ = '\n';


std::common_iterator<std::counted_iterator<std::ostream_iterator<float>>,
std::default_sentinel_t>
first { std::counted_iterator{std::ostream_iterator<float>{std::cout," ~ "}, 5} },
last { std::default_sentinel };
std::iota(first, last, 2.2);
*oo++ = '\n';
}


-1, -1, -1, -1, -1,
3.14; 2.71;
2.2 ~ 3.2 ~ 4.2 ~ 5.2 ~ 6.2 ~


Defect reports


The following behavior-changing defect reports were applied retroactively to
previously published C++ standards.


DR Applied to Behavior as published Correct behavior
default constructor was provided as C++20 removed along with the
P2325R3 C++20 iterators requirement
must be default_initializable

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.