std::basic_stringbuf::swap
Aus 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 ) |
(seit C++11) | |
Tausch der Staat und die Inhalte der *this und
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.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
rhs | - | anderen
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. |
[Bearbeiten] Rückgabewert
(None)
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.
[Bearbeiten] Notes
Diese Funktion wird automatisch beim Austausch std::stringstream Objekte genannt wird, ist es nur selten notwendig, um es direkt anrufen .
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.
[Bearbeiten] Beispiel
#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"; }
Output:
Before swap, one = "one" two = "two" Before swap, one = "two" two = "one"
[Bearbeiten] Siehe auch
konstruiert eine basic_stringbuf Objekt 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. (öffentliche Elementfunktion) | |
(C++11) |
swaps two string streams (öffentliche Elementfunktion of std::basic_stringstream )
|