std::basic_stringbuf::swap
De cppreference.com
< cpp | io | basic stringbuf
![]() |
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. |
void swap( std::basic_stringbuf& rhs ) |
(depuis C++11) | |
Échanges de l'état et le contenu de *this et
rhs
.Original:
Swaps the state and the contents of *this and
rhs
.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.
Sommaire |
[modifier] Paramètres
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. |
[modifier] Retourne la valeur
(Aucun)
Original:
(none)
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.
[modifier] Notes
Cette fonction est appelée automatiquement quand vous échangez des objets std::stringstream, il est rarement nécessaire de l'appeler directement .
Original:
This function is called automatically when swapping std::stringstream objects, it is rarely necessary to call it 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.
[modifier] Exemple
#include <sstream> #include <string> #include <iostream> int main() { std::istringstream one("one"); std::ostringstream two("two"); std::cout << "Before swap, one = \"" << one.str() << '"' << " two = \"" << two.str() << "\"\n"; *one.rdbuf()->swap(*two.rdbuf()); std::cout << "Before swap, one = \"" << one.str() << '"' << " two = \"" << two.str() << "\"\n"; }
Résultat :
Before swap, one = "one" two = "two" Before swap, one = "two" two = "one"
[modifier] Voir aussi
construit un objet 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. (fonction membre publique) | |
(C++11) |
swaps de deux stringstreams Original: swaps two string streams 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 )
|