operator<< (<ostream>)
Scrive i vari tipi di flusso.
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
);
Parametri
_Ch
Carattere._Elem
Tipo dell'elemento._Ostr
Un oggetto basic_ostream._Str
Una stringa di caratteri._Tr
Tratti di carattere._Val
Il tipo
Valore restituito
Flusso.
Note
La classe basic_ostream definisce inoltre numerosi operatori di inserimento.Per ulteriori informazioni, vedere basic_ostream::operator<<.
La funzione di modello
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _ostr,
const Elem *_Str);
determina la lunghezza N = traits_type::durata()_Strl'inizio di sequenza a _Stre inserisce la sequenza.Se N < _Ostr.larghezza, quindi la funzione inserire anche una ripetizione _Ostr.width - caratteri di spaziatura N.La ripetizione precede la sequenza (se_Ostr.flag &! adjustfield = sinistro.In caso contrario, la ripetizione segue la sequenza.La funzione restituisce _Ostr.
La funzione di modello
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
Elem _Ch);
inserisce l'elemento _Ch.Se 1 < _Ostr.width, quindi la funzione inserire anche una ripetizione _Ostr.width - i caratteri di spaziatura 1.La ripetizione precede la sequenza se _Ostr.flags & adjustfield != left.In caso contrario, la ripetizione segue la sequenza.Restituisce _Ostr.
La funzione di modello
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
const char *_Str);
si comporta lo stesso come
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
const Elem *_Str);
ad eccezione del fatto che ogni elemento _Ch l'inizio di sequenza a _Str viene convertito in un oggetto di tipo Elem chiamando _Ostr.inserito(_Ostr.si ampliano(_Ch).
La funzione di modello
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
char _Ch);
si comporta lo stesso come
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
Elem _Ch);
con la differenza che _Ch viene convertito in un oggetto di tipo Elem chiamando _Ostr.put(_Ostr.widen(_Ch).
La funzione di modello
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
const char *_Str);
si comporta lo stesso come
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
const Elem *_Str);
(Non deve ampliarsi gli elementi prima di inserire essi.)
La funzione di modello
template<class _Tr>
basic_ostream<char, Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
char _Ch);
si comporta lo stesso come
template<class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
basic_ostream<Elem, _Tr>& _Ostr,
Elem _Ch);
(Non deve ampliarsi _Ch prima di inserire.)
La funzione di modello
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
const signed char *_Str);
restituisce _Ostr << (const char *)_Str.
La funzione di modello
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
signed char _Ch);
restituisce _Ostr << (char)_Ch.
La funzione di modello:
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
const unsigned char *_Str);
restituisce _Ostr << (const char *)_Str.
La funzione di modello:
template<class _Tr>
basic_ostream<char, _Tr>& operator<<(
basic_ostream<char, _Tr>& _Ostr,
unsigned char _Ch);
restituisce _Ostr << (char)_Ch.
La funzione di modello:
template<class _Elem, class _Tr, class _Ty>
basic_ostream<_Elem, _Tr>& operator<<(
basic_ostream<char, _Tr>&& _Ostr,
_Ty _Val
);
restituisce _Ostr<<_Val (e convertiti Riferimento RValue a _Ostr a un lvalue nel processo).
Esempio
Vedere sebbene per un esempio di utilizzo operator<<.
Requisiti
intestazione: <ostream>
Spazio dei nomi: deviazione standard