Aracılığıyla paylaş


<ostream> işleçleri

operator<<

operator<<

Akışa çeşitli türler yazar.

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 T>
basic_ostream <_Elem, _Tr>& operator<<(
    basic_ostream<_Elem, _Tr>&& _Ostr,
    Ty val);

Parametreler

_Caner
Bir karakter.

_Elem
Öğe türü.

_Ostr
Bir basic_ostream nesnesi.

Str
Karakter dizesi.

_Tr
Karakter özellikleri.

Val
Türü

İade Değeri

Akış.

Açıklamalar

basic_ostream sınıfı ayrıca birkaç ekleme işleci tanımlar. Daha fazla bilgi için bkz. basic_ostream::operator<<.

Şablon işlevi

template <class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
    basic_ostream<Elem, _Tr>& _ostr,
    const Elem *str);

, str'de başlayan dizinin N = traits_type::uzunluk() uzunluğunustr belirler ve diziyi ekler. N <_Ostr.genişliği ise, işlev - N dolgu karakterlerinin yinelemesini _Ostr.width de ekler. Yineleme, diziden önce (_Ostr. bayraklar & adjustfield != sol. Aksi takdirde, yineleme dizisini izler. işlevi _Ostr döndürür.

Şablon işlevi

template <class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
    basic_ostream<Elem, _Tr>& _Ostr,
    Elem _Ch);

öğesini _Chekler. 1 <_Ostr.widthise, işlev ayrıca - 1 doldurma karakteri yinelemesi _Ostr.width ekler. yinelemesi ise _Ostr.flags & adjustfield != leftdiziden önce ulaşır. Aksi takdirde, yineleme dizisini izler. _Ostr döndürür.

Şablon işlevi

template <class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
    basic_ostream<Elem, _Tr>& _Ostr,
    const char *str);

ile aynı şekilde davranır

template <class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
    basic_ostream<Elem, _Tr>& _Ostr,
    const Elem *str);

ancak her öğe _Ch str'debaşlayan dizinin put(widen(_Ostr._Ch)) çağrılarak_Ostr. türündeki Elem bir nesneye dönüştürülür.

Şablon işlevi

template <class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
    basic_ostream<Elem, _Tr>& _Ostr,
    char _Ch);

ile aynı şekilde davranır

template <class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
    basic_ostream<Elem, _Tr>& _Ostr,
    Elem _Ch);

_Ch çağrılarak _Ostr.put( _Ostr.widen( _Ch ))türünde Elem bir nesneye dönüştürülmesi dışında.

Şablon işlevi

template <class _Tr>
basic_ostream<char, _Tr>& operator<<(
    basic_ostream<char, _Tr>& _Ostr,
    const char *str);

ile aynı şekilde davranır

template <class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
    basic_ostream<Elem, _Tr>& _Ostr,
    const Elem *str);

(Öğeleri eklemeden önce genişletmesi gerekmez.)

Şablon işlevi

template <class _Tr>
basic_ostream<char, Tr>& operator<<(
    basic_ostream<char, _Tr>& _Ostr,
    char _Ch);

ile aynı şekilde davranır

template <class _Elem, class _Tr>
basic_ostream<Elem, _Tr>& operator<<(
    basic_ostream<Elem, _Tr>& _Ostr,
    Elem _Ch);

(Eklemeden önce _Ch genişletmesi gerekmez.)

Şablon işlevi

template <class _Tr>
basic_ostream<char, _Tr>& operator<<(
    basic_ostream<char, _Tr>& _Ostr,
    const signed char *str);

döndürür _Ostr << (const char *)str.

Şablon işlevi

template <class _Tr>
basic_ostream<char, _Tr>& operator<<(
    basic_ostream<char, _Tr>& _Ostr,
    signed char _Ch);

döndürür _Ostr << (char)_Ch.

Şablon işlevi:

template <class _Tr>
basic_ostream<char, _Tr>& operator<<(
    basic_ostream<char, _Tr>& _Ostr,
    const unsigned char *str);

döndürür _Ostr << (const char *)str.

Şablon işlevi:

template <class _Tr>
basic_ostream<char, _Tr>& operator<<(
    basic_ostream<char, _Tr>& _Ostr,
    unsigned char _Ch);

döndürür _Ostr << (char)_Ch.

Şablon işlevi:

template <class _Elem, class _Tr, class T>
basic_ostream<_Elem, _Tr>& operator<<(
    basic_ostream<char, _Tr>&& _Ostr,
    T val);

döndürür _Ostr << val (ve RValue Başvuruyu işlemdeki bir lvalue'ya _Ostr dönüştürür).

Örnek

Kullanma operator<<örneği için bkz. temizleme.

Ayrıca bkz.

<Ostream>