<ostream> – funkce

Toto jsou globální funkce šablony definované v <ostream>. Členské funkce najdete v dokumentaci kebasic_ostream třídě.

endl

Ukončí čáru a vyprázdní vyrovnávací paměť.

template <class Elem, class Tr>
basic_ostream<Elem, Tr>& endl(
   basic_ostream<Elem, Tr>& Ostr);

Parametry

Elem
Typ elementu.

Ostr
Objekt typu basic_ostream.

Tr
Charakterové vlastnosti.

Návratová hodnota

Objekt typu basic_ostream.

Poznámky

Manipulátor volá Ostr.put(Ostr.widen('\n')) a pak zavolá Ostr.flush. Vrátí Ostr.

Příklad

// ostream_endl.cpp
// compile with: /EHsc
#include <iostream>

int main( )
{
   using namespace std;
   cout << "testing" << endl;
}
testing

ends

Ukončí řetězec.

template <class Elem, class Tr>
basic_ostream<Elem, Tr>& ends(
   basic_ostream<Elem, Tr>& Ostr);

Parametry

Elem
Typ elementu.

Ostr
Objekt typu basic_ostream.

Tr
Charakterové vlastnosti.

Návratová hodnota

Objekt typu basic_ostream.

Poznámky

Manipulátor volá Ostr.put(Elem('\0')). Vrátí Ostr.

Příklad

// ostream_ends.cpp
// compile with: /EHsc
#include <iostream>

int main( )
{
   using namespace std;
   cout << "a";
   cout << "b" << ends;
   cout << "c" << endl;
}
ab c

flush

Vyprázdní vyrovnávací paměť.

template <class Elem, class Tr>
basic_ostream<Elem, Tr>& flush(
   basic_ostream<Elem, Tr>& Ostr);

Parametry

Elem
Typ elementu.

Ostr
Objekt typu basic_ostream.

Tr
Charakterové vlastnosti.

Návratová hodnota

Objekt typu basic_ostream.

Poznámky

Manipulátor volá Ostr.flush. Vrátí Ostr.

Příklad

// ostream_flush.cpp
// compile with: /EHsc
#include <iostream>

int main( )
{
   using namespace std;
   cout << "testing" << flush;
}
testing

swap

Vymění hodnoty dvou basic_ostream objektů.

template <class Elem, class Tr>
void swap(
   basic_ostream<Elem, Tr>& left,
   basic_ostream<Elem, Tr>& right);

Parametry

Elem
Typ elementu.

Tr
Charakterové vlastnosti.

left
Lvalue odkaz na basic_ostream objekt.

right
Lvalue odkaz na basic_ostream objekt.

Poznámky

Funkce šablony swapleft.swap(right)se spustí .

Viz také

<ostream>