std::ostream_iterator

Da cppreference.com.
< cpp‎ | iterator

 
 
Biblioteca Iterator
Primitive iteratori
Original:
Iterator primitives
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iterator_traits
input_iterator_tag
output_iterator_tag
forward_iterator_tag
bidirectional_iterator_tag
random_access_iterator_tag
iterator
Adattatori iteratori
Original:
Iterator adaptors
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
reverse_iterator
Flusso iteratori
Original:
Stream iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istream_iterator
ostream_iterator
istreambuf_iterator
ostreambuf_iterator
Operazioni di iteratori
Original:
Iterator operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
advance
distance
prev(C++11)
next(C++11)
Intervallo accesso
Original:
Range access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
begin(C++11)
end(C++11)
 
std::ostream_iterator
Membri funzioni
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.
ostream_iterator::ostream_iterator
ostream_iterator::~ostream_iterator
ostream_iterator::operator=
ostream_iterator::operator*
ostream_iterator::operator++
ostream_iterator::operator++(int)
 
Elemento definito nell'header <iterator>
template< class T,

          class CharT = char,
          class Traits = std::char_traits<charT>>
class ostream_iterator : public std::iterator<std::output_iterator_tag,

                                              void, void, void, void>
std::ostream_iterator è un passaggio singolo iteratore di output che scrive gli oggetti successivi di tipo T nell'oggetto std::basic_ostream per il quale è stato costruito, utilizzando operator<<. Opzionale delimitatore di stringa viene scritto nel flusso di output dopo ogni operazione di scrittura. L'operazione di scrittura viene eseguita quando l'iteratore (se referenziato o meno) è assegnato. Incremento del std::ostream_iterator è un no-op.
Original:
std::ostream_iterator is a single-pass output iterator that writes successive objects of type T into the std::basic_ostream object for which it was constructed, using operator<<. Optional delimiter string is written to the output stream after every write operation. The write operation is performed when the iterator (whether dereferenced or not) is assigned to. Incrementing the std::ostream_iterator is a no-op.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
In una tipica implementazione, i membri dei soli dati di std::ostream_iterator sono un puntatore al std::basic_ostream associato e un puntatore al primo carattere della stringa delimitatore.
Original:
In a typical implementation, the only data members of std::ostream_iterator are a pointer to the associated std::basic_ostream and a pointer to the first character in the delimiter string.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Durante la scrittura di caratteri, std::ostreambuf_iterator è più efficiente, dato che evita il sovraccarico di costruire e distruggendo l'oggetto sentinella una volta per carattere.
Original:
When writing characters, std::ostreambuf_iterator is more efficient, since it avoids the overhead of constructing and destructing the sentry object once per character.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Indice

[modifica] Membri tipi

Membro tipo
Original:
Member type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
char_typeCharT
traits_typeTraits
ostream_typestd::basic_ostream<CharT, Traits>

[modifica] Membri funzioni

costruisce un nuovo ostream_iterator
Original:
constructs a new ostream_iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico)
distrugge un ostream_iterator
Original:
destructs an ostream_iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico)
scrive un oggetto alla sequenza uscita associata
Original:
writes a object to the associated output sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico)
no-op
(metodo pubblico)
no-op
(metodo pubblico)

Inherited from std::iterator

Member types

Membro tipo
Original:
Member type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
value_typevoid
difference_typevoid
pointervoid
referencevoid
iterator_categorystd::output_iterator_tag

[modifica] Esempio

#include <iostream>
#include <sstream>
#include <iterator>
#include <algorithm>
int main()
{
    std::istringstream str("0.1 0.2 0.3 0.4");
    std::partial_sum( std::istream_iterator<double>(str),
                      std::istream_iterator<double>(),
                      std::ostream_iterator<double>(std::cout, " "));
}

Output:

0.1 0.3 0.6 1

[modifica] Vedi anche

uscita iteratore che scrive std::basic_streambuf
Original:
output iterator that writes to std::basic_streambuf
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe template) [modifica]
iteratore di input che legge da std::basic_istream
Original:
input iterator that reads from std::basic_istream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe template) [modifica]