std::basic_ostream::basic_ostream
提供:cppreference.com
< cpp | io | basic ostream
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| explicit basic_ostream( std::basic_streambuf<CharT, Traits>* sb ); |
(1) | |
| protected: basic_ostream( const basic_ostream& rhs ) = delete; |
(2) | |
| protected: basic_ostream( basic_ostream&& rhs ); |
(3) | (C + + 11以来) |
basic_ostreamを呼び出すことによって、基底クラスに初期値を代入し、basic_ios::init(sb)オブジェクトを構築し.Original:
Constructs the
basic_ostream object, assigning initial values to the base class by calling basic_ios::init(sb).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
コピーコンストラクタは保護されており、削除されます。出力ストリームがコピーできませんです.
3) Original:
The copy constructor is protected, and is deleted. Output streams are not copyable.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
ムーブコンストラクタは
basic_ios<CharT, Traits>::move(rhs)からrdbuf()に、rhsを除き、すべてのbasic_iosメンバーを移動する*this使用しています。このムーブコンストラクタは保護されています:それは、可動出力ストリームクラスのムーブコンストラクタstd::basic_ofstreamとstd::basic_ostringstream、正しく関連付けられたストリームバッファを移動する方法を知っているから呼び出されます.Original:
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.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] パラメータ
| sb | - | 出力シーケンスとして使用するストリームバッファ
Original: streambuffer to use as output sequence The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| rhs | - | から初期化することがあるbasic_ostream
Original: basic_ostream to initialize from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 例
#include <sstream> #include <utility> #include <iostream> int main() { // std::ostream myout(std::cout); // ERROR: copy ctor is deleted std::ostream myout(std::cout.rdbuf()); // OK: shares buffer with cout // std::ostream s2(std::move(std::ostringstream() << 7.1)); // ERROR: move constructor // is protected std::ostringstream s2(std::move(std::ostringstream() << 7.1)); // OK: move ctor called // through the derived class myout << s2.str() << '\n'; }
Output:
7.1