Namensräume
Varianten
Aktionen

std::basic_ostream::operator<<

Aus cppreference.com
< cpp‎ | io‎ | basic ostream

 
 
Input / Output-Bibliothek
I / O-Manipulatoren
C-style I / O
Puffern
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(veraltet)
Streams
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstraktionen
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
Datei-I / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
String I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Array I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(veraltet)
ostrstream(veraltet)
strstream(veraltet)
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Fehler Kategorie Schnittstelle
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_ostream
Globale Objekte
Original:
Global objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Member-Funktionen
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::basic_ostream
basic_ostream::~basic_ostream
basic_ostream::operator=(C++11)
Formatierte Eingabe
Original:
Formatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::operator<<
Unformatierte Eingabe
Original:
Unformatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::put
basic_ostream::write
Positionierung
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::tellp
basic_ostream::seekp
Verschiedenes
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::flush
basic_ostream::swap(C++11)
Mitglied Klassen
Original:
Member classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::sentry
Non-Member-Funktionen
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator<<(std::basic_ostream)
 
basic_ostream& operator<<( short value );
basic_ostream& operator<<( unsigned short value );
(1)
basic_ostream& operator<<( int value );
basic_ostream& operator<<( unsigned int value );
(2)
basic_ostream& operator<<( long value );
basic_ostream& operator<<( unsigned long value );
(3)
basic_ostream& operator<<( long long value );
basic_ostream& operator<<( unsigned long long value );
(4) (seit C++11)
basic_ostream& operator<<( float value );

basic_ostream& operator<<( double value );

basic_ostream& operator<<( long double value );
(5)
basic_ostream& operator<<( bool value );
(6)
basic_ostream& operator<<( const void* value );
(7)
basic_ostream& operator<<( std::basic_streambuf<CharT, Traits>* sb);
(8)
basic_ostream& operator<<( basic_ostream& st,

                           std::ios_base& (*func)(std::ios_base&) );
basic_ostream& operator<<( basic_ostream& st,
                           std::basic_ios<CharT,Traits>& (*func)(std::basic_ios<CharT,Traits>&) );
basic_ostream& operator<<( basic_ostream& st,

                           std::basic_ostream& (*func)(std::basic_ostream&) );
(9)
Fügt Daten in den Strom .
Original:
Inserts data into the stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Die (1-7)-Versionen des Betreibers verhalten, als formatierte Ausgabe-Funktionen, und das 8)-Version verhält sich wie unformatierte Ausgabe-Funktion. Diese Funktionen beginnen die Ausführung durch den Bau ein Objekt vom Typ sentry, die spült die tie()'d Ausgabepuffer wenn nötig und die Stream-Fehler überprüft. Nach dem Bau, wenn die Wache Objekt kehrt false, kehren die Funktionen, ohne den Versuch keine Ausgabe. Wenn ein Fehler auftritt während der Ausgabe, stellen formatierte Ausgabe-Funktionen setstate(ios_base::failbit). Wenn eine Ausnahme während der Ausgabe ausgelöst wird, dann ios :: badbit gesetzt ist (die Ausnahme unterdrückt sofern (exceptions()&badbit) != 0, in welchem ​​Fall es wird erneut ausgelöst)
Original:
The (1-7) versions of the operator behave as formatted output functions, and the 8) version behaves as unformatted output function. These functions begin execution by constructing an object of type sentry, which flushes the tie()'d output buffers if necessary and checks the stream errors. After construction, if the sentry object returns false, the functions return without attempting any output. If an error occurs during output, formatted output functions set setstate(ios_base::failbit). If an exception is thrown during output, then ios::badbit is set (the exception is suppressed unless (exceptions()&badbit) != 0, in which case it is rethrown)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1-2)
Wenn value ist short oder int, dann wirft es unsigned short oder unsigned int wenn ios_base::flags() & ios_base::basefield ist ios_base::oct oder ios_base::hex. Danach wirft die long in jedem Fall und Ausgänge wie in 3). Wenn value ist unsigned short oder unsigned int, wirft die unsigned long und Ausgänge wie in 3)
Original:
If value is short or int, then casts it to unsigned short or unsigned int if ios_base::flags() & ios_base::basefield is ios_base::oct or ios_base::hex. After that, casts to long in any case and outputs as in 3). If value is unsigned short or unsigned int, casts to unsigned long and outputs as in 3)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3-4)
Fügt ein Integer-Wert durch den Aufruf num_put::put(). Wenn das Ende der Datei Zustand während der Ausgabe angetroffen wurde (put().failed() == true), setzt ios::badbit .
Original:
Inserts an integer value by calling num_put::put(). If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
Fügt ein Gleitkommawert indem num_put::put() Wenn das Ende der Datei Zustand während Ausgang (put().failed() == true) angetroffen wurde, setzt ios::badbit .
Original:
Inserts a floating point value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
Fügt bool Wert durch Aufrufen num_put::put() Wenn das Ende der Datei Zustand während Ausgang (put().failed() == true) angetroffen wurde, setzt ios::badbit .
Original:
Inserts bool value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7)
Fügt ein generischer Zeiger Wert durch Aufrufen num_put::put() Wenn das Ende der Datei Zustand während Ausgang (put().failed() == true) angetroffen wurde, setzt ios::badbit .
Original:
Inserts a generic pointer value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
Fügt alle Daten aus sb. Nach dem Bau der Wache Objekt prüft, ob sb ist ein NULL-Zeiger. Wenn ja, führt setstate(badbit) und Ausfahrten. Anderenfalls extrahiert Zeichen aus der Eingangssequenz von sb und fügt sie in *this gesteuert, bis eine der folgenden Bedingungen erfüllt sind:
Original:
Inserts all data from sb. After constructing the sentry object, checks if sb is a null pointer. If it is, executes setstate(badbit) and exits. Otherwise, extracts characters from the input sequence controlled by sb and inserts them into *this until one of the following conditions are met:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • End-of-file tritt auf der Eingangssequenz;
    Original:
    end-of-file occurs on the input sequence;
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Einfügen in der Ausgangssequenz fehlschlägt (in welchem ​​Fall das Zeichen eingefügt wird nicht extrahiert);
    Original:
    inserting in the output sequence fails (in which case the character to be inserted is not extracted);
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • eine Ausnahme auftritt (in welchem ​​Fall das Ausnahme abgefangen wird) .
    Original:
    an exception occurs (in which case the exception is caught).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Wenn keine Zeichen eingefügt wurden, führt setstate(badbit). Wenn eine Ausnahme geworfen wurde beim Extrahieren, setzt failbit
Original:
If no characters were inserted, executes setstate(badbit). If an exception was thrown while extracting, sets failbit
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
Ruft func(*this);. Diese Überladung wird verwendet, um Ausgang I / O-Manipulatoren, wie std::endl umzusetzen .
Original:
Calls func(*this);. This overload is used to implement output I/O manipulators such as std::endl.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten] Parameter

value -
integer, floating-point, boolean oder Zeiger-Wert einzufügen
Original:
integer, floating-point, boolean, or pointer value to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
func -
funktionieren zu nennen
Original:
function to call
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
sb -
Zeiger auf die streambuffer zu lesen die Daten aus
Original:
pointer to the streambuffer to read the data from
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

*this

[Bearbeiten] Notes

Es gibt keine Überlastung für Zeiger auf volatile oder Funktion Zeiger (andere als die mit Unterschriften von der 9 akzeptiert) Überlast). Der Versuch, solche Objekte auszugeben aufruft implizite Konvertierung in bool, und für alle Nicht-Null-Zeiger-Wert, der Wert 1 gedruckt wird (es sei denn boolalpha gesetzt wurde) .
Original:
There are no overload for pointers to volatile or function pointers (other than the ones with signatures accepted by the 9) overload). Attempting to output such objects invokes implicit conversion to bool, and, for any non-null pointer value, the value 1 is printed (unless boolalpha was set).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Beispiel

#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
    std::istringstream input(" \"Some text.\" ");
    volatile int n = 42;
    double f = 3.14;
    bool b = true;;
    std::cout << n   // int overload
              << ' ' // non-member overload
              << std::boolalpha << b // bool overload
              << " " // non-member overload
              << std::fixed << f // double overload
              << input.rdbuf() // streambuf overload
              << &n // bool overload
              << std::endl; // function overload
}

Output:

42 true 3.140000 "Some text." true

[Bearbeiten] Siehe auch

Einsätze Zeichendaten
Original:
inserts character data
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktion) [edit]
führt Stream I / O von Strings
Original:
performs stream I/O of strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template)
führt Stream Ein-und Ausgang BitSets
Original:
performs stream input and output of bitsets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktion)
serialisiert und deserialisiert eine komplexe Zahl
Original:
serializes and deserializes a complex number
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template)
führt Stream Ein-und Ausgang auf Pseudo-Zufallszahlen-Motor
Original:
performs stream input and output on pseudo-random number engine
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktion) [edit]
Stream führt Eingabe und Ausgabe auf Pseudozufallszahl Verteilung
Original:
performs stream input and output on pseudo-random number distribution
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktion) [edit]
fügt ein Zeichen
Original:
inserts a character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion) [edit]
Einsätze Blöcken von Zeichen
Original:
inserts blocks of characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion) [edit]