operator<< (<ostream>)
Zapisuje różnych typów w strumieniu.
template<class _Elem, class _Tr>
basic_ostream<_Elem, _Tr>& operator<<(
basic_ostream<_Elem, _Tr>& _Ostr,
const Elem *_Str
);
template<class _Elem, class _Tr>
basic_ostream<_Elem, _Tr>& operator<<(
basic_ostream<_Elem, _Tr>& _Ostr,
Elem _Ch
);
template<class _Elem, class _Tr>
basic_ostream<_Elem, _Tr>& operator<<(
basic_ostream<_Elem, _Tr>& _Ostr,
const char *_Str
);
template<class _Elem, class _Tr>
basic_ostream<_Elem, _Tr>& operator<< (
basic_ostream<_Elem, _Tr>& _Ostr,
char _Ch
);
template<class _Tr>
basic_ostream<char, _Tr>& operator<< (
basic_ostream<char, _Tr>& _Ostr,
const char *_Str
);
template<class _Tr>
basic_ostream<char, _Tr>& operator<< (
basic_ostream<char, _Tr>& _ostr,
char _Ch
);
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
const signed char *_Str
);
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
signed char _Ch
);
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
const unsigned char *_Str
);
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
unsigned char _Ch
);
template<class _Elem, class _Tr, class _Ty>
basic_ostream<_Elem, _Tr>& operator<<(
basic_ostream<_Elem, _Tr>&& _Ostr,
Ty _Val
);
Parametry
_Ch
Znak._Elem
Typ elementu._Ostr
Obiekt basic_ostream._Str
Ciąg znaków._Tr
Cechy charakteru._Val
Typ
Wartość zwracana
Strumień.
Uwagi
basic_ostream Klasa definiuje także kilka operatorów wstawiania.Aby uzyskać dodatkowe informacje, zobacz basic_ostream::operator<<.
Funkcja szablonu
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _ostr,
const Elem *_Str);
Określa długość N = traits_type::długość(_Str) na początku sekwencji _Stri wstawia sekwencji.Jeśli N <_Ostr.Szerokość, a następnie funkcja również wstawia powtórzenia _Ostr.width -N wypełnienia znaków.Powtarzanie poprzedza sekwencji, jeśli (_Ostr.flagi&adjustfield != left.W przeciwnym wypadku powtarzanie następujące sekwencji.Funkcja zwraca _Ostr.
Funkcja szablonu
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
Elem _Ch);
Wstawia element _Ch.Jeśli 1 <_Ostr.width, a następnie funkcja również wstawia powtórzenia _Ostr.width - 1 wypełnić znaków.Powtarzanie poprzedza sekwencji, jeśli _Ostr.flags & adjustfield != left.W przeciwnym wypadku powtarzanie następujące sekwencji.Zwraca _Ostr.
Funkcja szablonu
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
const char *_Str);
działa tak samo, jak
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
const Elem *_Str);
chyba że każdy element _Ch z początku sekwencji w _Str jest konwertowany na obiekt typu Elem przez wywołanie _Ostr.umieścić(_Ostr.poszerzyć(_Ch)).
Funkcja szablonu
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
char _Ch);
działa tak samo, jak
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
Elem _Ch);
poza tym _Ch jest konwertowany na obiekt typu Elem przez wywołanie _Ostr.put(_Ostr.widen(_Ch)).
Funkcja szablonu
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
const char *_Str);
działa tak samo, jak
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
const Elem *_Str);
(To nie trzeba poszerzyć elementy przed ich wstawieniem.)
Funkcja szablonu
template<class _Tr>
basic_ostream<char, Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
char _Ch);
działa tak samo, jak
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
Elem _Ch);
(Nie trzeba poszerzyć _Ch przed jego wstawieniem.)
Funkcja szablonu
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
const signed char *_Str);
returns _Ostr<< (const char *)_Str.
Funkcja szablonu
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
signed char _Ch);
returns _Ostr<< (char)_Ch.
Funkcja szablonu:
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
const unsigned char *_Str);
returns _Ostr<< (const char *)_Str.
Funkcja szablonu:
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
unsigned char _Ch);
returns _Ostr<< (char)_Ch.
Funkcja szablonu:
template<class _Elem, class _Tr, class _Ty>
basic_ostream<_Elem, _Tr>& operator<<(
basic_ostream<char, _Tr>&& _Ostr,
_Ty _Val
);
Zwraca _Ostr << _Val (i konwertuje R-wartości odniesienia do _Ostr do lvalue w procesie).
Przykład
Zobacz opróżnić na przykład za pomocą operator<<.
Wymagania
Nagłówek:<ostream>
Przestrzeń nazw: std