std::basic_stringbuf::basic_stringbuf
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
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 | std::ios_base::out); |
(2) | |
basic_stringbuf(const basic_stringbuf& rhs) = delete; |
(3) | |
basic_stringbuf(basic_stringbuf&& rhs); |
(4) | (desde C++11) |
1)
Construye un objeto
std::basic_stringbuf: inicializa la clase base llamando al constructor por defecto de std::basic_streambuf, inicializa la secuencia de caracteres con una cadena vacía, y establece el modo para 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)
Construye un objeto
std::basic_stringbuf mediante la realización de la misma inicialización como 1), seguido por la inicialización de la secuencia de caracteres asociado como si se aplicase 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)
.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)
El constructor de copia se suprime
std::basic_stringbuf no es CopyConstructibleOriginal:
The copy constructor is deleted;
std::basic_stringbuf is not CopyConstructibleThe 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)
Move-construye un objeto
std::basic_stringbuf moviendo todo el estado de otro objeto std::basic_stringbuf rhs, incluyendo la cadena asociada, la modalidad abierta, el lugar, y todo otro estado. Después del movimiento, los seis punteros de std::basic_streambuf en *this están garantizados para ser diferentes de los punteros correspondientes en el rhs-movido desde menos nulo .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.
Parámetros
| new_str | - | un
basic_string utiliza para inicializar el buffer 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 | - | otro
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 | - | especifica el modo de transmisión abierta. Es el tipo de máscara de bits, las siguientes constantes son 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. |
Notas
Por lo general convocada por el constructor de 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.
El nivel de soporte para los modos que no sean abiertas y std::ios_base::in std::ios_base::out varía entre implementaciones. C + 11 especifica explícitamente el apoyo a std::ios_base::ate en
str() y en este constructor, pero std::ios_base::app, std::ios_base::trunc y std::ios_base::binary tener efectos diferentes en las distintas aplicaciones .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.
Ejemplo
Demuestra una llamada al constructor de basic_stringbuf directamente .
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.
Ejecuta este código
#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';
}
Salida:
1
test1
est12 (Sun Studio) 2st1 (GCC)
Ver también
construye la corriente de cadena 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. (función miembro pública de std::basic_stringstream)
|