std::basic_stringbuf::basic_stringbuf
De cppreference.com
[] |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> 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) | (depuis C++11) |
1)
Construit un objet
std::basic_stringbuf: initialise la classe de base en appelant le constructeur par dfaut de std::basic_streambuf, initialise la squence de caractres d'une chane vide, et dfinit le mode 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.
You can help to correct and verify the translation. Click here for instructions.
2)
Construit un objet
std::basic_stringbuf par l'excution de l'initialisation identique 1), suivie de l'initialisation de la squence de caractres associ, comme si en appelant 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)
Le constructeur de copie est supprime;
std::basic_stringbuf n'est pas 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-construit un objet en dplaant toutes
std::basic_stringbuf tat d'un autre objet std::basic_stringbuf rhs, y compris la chane associe, le mode d'ouverture, la localisation, et tout autre Etat. Aprs le dmnagement, les six pointeurs de std::basic_streambuf dans *this sont garantis d'tre diffrent des pointeurs correspondants dans la rhs dplac-de moins que nulle .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.
Paramtres
| new_str | - | un
basic_string utilis pour initialiser la mmoire tampon 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 autre 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 | - | spcifie le mode de flux ouvert. Il est de type masque, les constantes suivantes sont dfinies:
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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Notes
En rgle gnrale appele par le constructeur 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.
Le niveau de soutien pour les modes autres que std::ios_base::in ouverts et std::ios_base::out varie selon les implmentations. C + 11 spcifie explicitement le soutien std::ios_base::ate dans
str() et en ce constructeur, mais std::ios_base::app, std::ios_base::trunc et std::ios_base::binary ont des effets diffrents sur diffrentes implmentations .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.
Exemple
Illustre l'appel du constructeur de basic_stringbuf directement .
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';
}
Rsultat :
1
test1
est12 (Sun Studio) 2st1 (GCC)
Voir aussi
construit le flux de chane 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. (fonction membre publique de std::basic_stringstream)
| |