std::basic_ostream<CharT,Traits>::basic_ostream (3) - Linux Manuals
std::basic_ostream<CharT,Traits>::basic_ostream: std::basic_ostream<CharT,Traits>::basic_ostream
Command to display std::basic_ostream<CharT,Traits>::basic_ostream
manual in Linux: $ man 3 std::basic_ostream<CharT,Traits>::basic_ostream
NAME
std::basic_ostream<CharT,Traits>::basic_ostream - std::basic_ostream<CharT,Traits>::basic_ostream
Synopsis
explicit basic_ostream( std::basic_streambuf<CharT, Traits>* sb ); (1)
protected: (2) (since C++11)
basic_ostream( const basic_ostream& rhs ) = delete;
protected: (3) (since C++11)
basic_ostream( basic_ostream&& rhs );
1) Constructs the basic_ostream object, assigning initial values to the base class by calling basic_ios::init(sb).
2) The copy constructor is protected, and is deleted. Output streams are not copyable.
3) The move constructor uses basic_ios<CharT, Traits>::move(rhs) to move all basic_ios members, except for the rdbuf(), from rhs into *this. This move constructor is protected: it is called by the move constructors of movable output stream classes std::basic_ofstream and std::basic_ostringstream, which know how to correctly move the associated streambuffer.
Parameters
sb - streambuffer to use as output sequence
rhs - basic_ostream to initialize from
Example
// Run this code
#include <sstream>
#include <utility>
#include <iostream>
int main()
{
// ERROR: copy ctor is deleted
// std::ostream myout(std::cout);
// OK: shares buffer with cout
std::ostream myout(std::cout.rdbuf());
// ERROR: move constructor is protected
// std::ostream s2(std::move(std::ostringstream() << 7.1));
// OK: move ctor called through the derived class
std::ostringstream s2(std::move(std::ostringstream() << 7.1));
myout << s2.str() << '\n';
}
Output:
7.1
Pages related to std::basic_ostream<CharT,Traits>::basic_ostream
- std::basic_ostream<CharT,Traits>::flush (3) - std::basic_ostream<CharT,Traits>::flush
- std::basic_ostream<CharT,Traits>::operator<< (3) - std::basic_ostream<CharT,Traits>::operator<<
- std::basic_ostream<CharT,Traits>::operator= (3) - std::basic_ostream<CharT,Traits>::operator=
- std::basic_ostream<CharT,Traits>::put (3) - std::basic_ostream<CharT,Traits>::put
- std::basic_ostream<CharT,Traits>::seekp (3) - std::basic_ostream<CharT,Traits>::seekp
- std::basic_ostream<CharT,Traits>::sentry (3) - std::basic_ostream<CharT,Traits>::sentry
- std::basic_ostream<CharT,Traits>::swap (3) - std::basic_ostream<CharT,Traits>::swap
- std::basic_ostream<CharT,Traits>::tellp (3) - std::basic_ostream<CharT,Traits>::tellp
- std::basic_ostream<CharT,Traits>::write (3) - std::basic_ostream<CharT,Traits>::write
- std::basic_ostream<CharT,Traits>::~basic_ostream (3) - std::basic_ostream<CharT,Traits>::~basic_ostream
- std::basic_ostream (3) - std::basic_ostream
- std::basic_ostream_sentry (3)
- std::basic_ostringstream (3) - std::basic_ostringstream
- std::basic_ostringstream::operator= (3) - std::basic_ostringstream::operator=
- std::basic_ostringstream::rdbuf (3) - std::basic_ostringstream::rdbuf
- std::basic_ostringstream::swap (3) - std::basic_ostringstream::swap
- std::basic_ostringstream<CharT,Traits,Allocator>::basic_ostringstream (3) - std::basic_ostringstream<CharT,Traits,Allocator>::basic_ostringstream
- std::basic_ostringstream<CharT,Traits,Allocator>::str (3) - std::basic_ostringstream<CharT,Traits,Allocator>::str
- std::basic_osyncstream (3) - std::basic_osyncstream