std::basic_stringbuf::basic_stringbuf - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
|
|
(1) | |
|
|
(2) | |
|
|
(3) | |
|
|
(4) | (desde C++11) |
1)
Constrói um objeto std::basic_stringbuf: inicializa a classe base chamando o construtor padrão de std::basic_streambuf, inicializa a seqüência de caracteres com uma string vazia, e define o modo de 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.
3)
O construtor de cópia é apagado; std::basic_stringbuf não é 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.
4)
Move-constrói um objeto std::basic_stringbuf movendo todo o estado de outro objeto std::basic_stringbuf rhs, incluindo a cadeia associada, o modo de abertura, o local, e todos os outro estado. Após a mudança, os seis indicadores de std::basic_streambuf em *this são garantidos para ser diferente dos ponteiros correspondentes na rhs moveu-de não ser 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.
Parâmetros
| new_str | - | um Original: a The text has been machine-translated via Google Translate. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rhs | - | outro Original: another The text has been machine-translated via Google Translate. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Notas
Normalmente chamado pelo construtor 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.
O nível de suporte para os modos de abrir outros que std::ios_base::in e std::ios_base::out varia entre execuções. C + 11 especifica explicitamente o suporte para std::ios_base::ate em str() e neste construtor, mas std::ios_base::app, std::ios_base::trunc, e std::ios_base::binary ter efeitos diferentes em diferentes implementações.
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.
Exemplo
Demonstra chamando o construtor de basic_stringbuf diretamente .
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.
#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'; }
Saída:
1 test1 est12 (Sun Studio) 2st1 (GCC)
Veja também
constrói o fluxo de cadeia Original: constructs the string stream The text has been machine-translated via Google Translate. (of std::basic_stringstream função pública membro) [edit]
| |