std::basic_ostringstream::basic_ostringstream
De cppreference.com
<metanoindex/>
<tbody> </tbody> basic_ostringstream( ios_base::openmode mode = ios_base::out ); |
(1) | |
basic_ostringstream( const std::basic_string<CharT,Traits,Allocator>& str, {{#pad:|19}} ios_base::openmode mode = ios_base::out ); |
(2) | |
basic_ostringstream( basic_ostringstream&& other ); |
(3) | (desde C++11) |
Constrói fluxo nova cadeia.
Original:
Constructs new string stream.
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.
1)
Constrói dispositivo nova cadeia subjacente. O objecto subjacente
basic_stringbuf é construído como basic_stringbuf<Char,Traits,Allocator>(mode | ios_base::out).Original:
Constructs new underlying string device. The underlying
basic_stringbuf object is constructed as basic_stringbuf<Char,Traits,Allocator>(mode | ios_base::out).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)
Usa uma cópia de
str como conteúdo inicial do dispositivo de cordão subjacente. O objecto subjacente basic_stringbuf é construído como basic_stringbuf<Char,Traits,Allocator>(str, mode | ios_base::out).Original:
Uses a copy of
str as initial contents of the underlying string device. The underlying basic_stringbuf object is constructed as basic_stringbuf<Char,Traits,Allocator>(str, mode | ios_base::out).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)
Mova construtor. Constrói o fluxo de arquivos com o estado de
other usando semântica mover. Original:
Move constructor. Constructs the file stream with the state of
other using move semantics. 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.
Parâmetros
| str | - | string para usar como conteúdo inicial do fluxo de seqüência
Original: string to use as initial contents of 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mode | - | especifica o modo de fluxo aberto. Ele é o tipo de máscara de bits, as seguintes constantes são definidas:
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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| other | - | outro fluxo string para usar como fonte
Original: another string stream to use as source The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Exemplo
#include <iostream>
#include <sstream>
int main()
{
// default constructor (input/output stream)
std::stringstream buf1;
buf1 << 7;
int n = 0;
buf1 >> n;
std::cout << "buf1 = " << buf1.str() << " n = " << n << '\n';
// input stream
std::istringstream inbuf("-10");
inbuf >> n;
std::cout << "n = " << n << '\n';
// output stream in append mode (C++11)
std::ostringstream buf2("test", std::ios_base::ate);
buf2 << '1';
std::cout << buf2.str() << '\n';
}
Saída:
buf1 = 7 n = 7
n = -10
test1
