std::basic_stringstream::basic_stringstream
Da cppreference.com.
< cpp | io | basic stringstream
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
basic_stringstream( ios_base::openmode mode = ios_base::in|ios_base::out ); |
(1) | |
basic_stringstream( const std::basic_string<CharT,Traits,Allocator>& str, ios_base::openmode mode = ios_base::in|ios_base::out ); |
(2) | |
basic_stringstream( basic_stringstream&& other ); |
(3) | (dal C++11) |
Costruisce nuovo flusso di stringa.
1) 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.
Costruisce nuovo dispositivo sottostante stringa. L'oggetto
2) basic_stringbuf
sottostante è costruito come basic_stringbuf<Char,Traits,Allocator>(mode).Original:
Constructs new underlying string device. The underlying
basic_stringbuf
object is constructed as basic_stringbuf<Char,Traits,Allocator>(mode).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.
Utilizza una copia di
3) str
come contenuto iniziale del dispositivo stringa sottostante. L'oggetto basic_stringbuf
sottostante è costruito come basic_stringbuf<Char,Traits,Allocator>(str, mode).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).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.
Sposta costruttore. Costruisce il flusso di file con lo stato di
other
usando la semantica si muovono. 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.
[modifica] Parametri
str | - | stringa da utilizzare come contenuto iniziale del flusso di stringa
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 | - | specifica modalità di apertura flusso. E 'tipo di maschera di bit, le seguenti costanti sono definite:
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 | - | un altro flusso stringa da utilizzare come 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. |
[modifica] Esempio
#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'; }
Output:
buf1 = 7 n = 7 n = -10 test1
[modifica] Vedi anche
ottiene o imposta il contenuto di oggetto sottostante dispositivo stringa Original: gets or sets the contents of underlying string device object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
costruisce un oggetto basic_stringbuf Original: constructs a basic_stringbuf object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) |