std::basic_stringbuf::basic_stringbuf
提供: cppreference.com
< cpp | io | basic stringbuf
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
explicit basic_stringbuf(std::ios_base::openmode which = std::ios_base::in | std::ios_base::out); |
(1) | |
explicit basic_stringbuf (const std::basic_string<CharT, traits, Allocator>& new_str, std::ios_base::openmode which = std::ios_base::in |
(2) | |
basic_stringbuf(const basic_stringbuf& rhs) = delete; |
(3) | |
basic_stringbuf(basic_stringbuf&& rhs); |
(4) | (C++11およびそれ以降) |
1)
std::basic_stringbuf
オブジェクトを構築します:std::basic_streambufの既定のコンストラクターを呼び出して、基本クラスを初期化し、空の文字列を使用して文字列を初期化し、which
にモードを設定します。.Original:
Constructs a
std::basic_stringbuf
object: initializes the base class by calling the default constructor of std::basic_streambuf, initializes the character sequence with an empty string, and sets the mode to which
.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.
2) オブジェクト)を、構築し.
std::basic_stringbuf
を呼び出したかのように関連付けられた文字列を初期化することによって、続いて1と同じ初期化を行うことにより、<div class="t-tr-text">STR(new_str)Original:
str(new_str)
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
Original:
Constructs a
std::basic_stringbuf
object by performing the same initialization as 1), followed by initializing the associated character sequence as if by calling STR(new_str)</div>.
Original:
str(new_str)
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
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)
コピーコンストラクタが削除されます。
std::basic_stringbuf
CopyConstructible
はありませんOriginal:
The copy constructor is deleted;
std::basic_stringbuf
is not CopyConstructible
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.
4)
std::basic_stringbuf
、関連付けられている文字列、オープンモード、ロケール、および他のすべての状態を含め、別のstd::basic_stringbuf
オブジェクトからすべての状態を移動させることによってrhs
オブジェクトは、Move-構築します。移動後、std::basic_streambufで*thisの6のポインタがnullでない限り動かさ-からrhs
で対応するポインタとは異なることが保証されています.Original:
Move-constructs a
std::basic_stringbuf
object by moving all state from another std::basic_stringbuf
object rhs
, including the associated string, the open mode, the locale, and all other state. After the move, the six pointers of std::basic_streambuf in *this are guaranteed to be different from the corresponding pointers in the moved-from rhs
unless null.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.
目次 |
[編集] パラメータ
new_str | - | basic_string は、バッファを初期化するために使用する Original: a basic_string used to initialize the buffer The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rhs | - | 別
basic_stringbuf Original: another basic_stringbuf The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mode | - | ストリームのオープンモードを指定します。それはビットマスク型ですが、以下の定数が定義されています:
Original: specifies stream open mode. It is bitmask type, the following constants are defined:
The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] ノート
一般的にstd::basic_stringstreamのコンストラクタによって呼び出さ.
Original:
Typically called by the constructor of std::basic_stringstream.
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.
オープンstd::ios_base::in以外のモードとstd::ios_base::outのサポートレベルは、実装によって異なります。 C + + 11は、明示的にstd::ios_base::ateで、このコンストラクタで
str()
のサポートを指定しますが、std::ios_base::app、std::ios_base::trunc、そしてstd::ios_base::binaryが異なる実装上の様々な効果を持っている.Original:
The level of support for the open modes other than std::ios_base::in and std::ios_base::out varies among implementations. C++11 explicitly specifies the support for std::ios_base::ate in
str()
and in this constructor, but std::ios_base::app, std::ios_base::trunc, and std::ios_base::binary have different effects on different implementations.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_stringbufのコンストラクタの呼び出しを示す.
Original:
Demonstrates calling the constructor of basic_stringbuf directly.
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.
このコードを実行します
#include <iostream> #include <sstream> int main() { // default constructor (mode = in|out) std::stringbuf buf1; buf1.sputc('1'); std::cout << &buf1 << '\n'; // string constructor in at-end mode (C++11) std::stringbuf buf2("test", std::ios_base::in | std::ios_base::out | std::ios_base::ate); buf2.sputc('1'); std::cout << &buf2 << '\n'; // append mode test (results differ among compilers) std::stringbuf buf3("test", std::ios_base::in | std::ios_base::out | std::ios_base::app); buf3.sputc('1'); buf3.pubseekpos(1); buf3.sputc('2'); std::cout << &buf3 << '\n'; }
出力:
1 test1 est12 (Sun Studio) 2st1 (GCC)
[編集] 参照
文字列ストリームを構築します Original: constructs the string stream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数of std::basic_stringstream )
|