std::ostream_iterator
De cppreference.com
[] |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody>| Dclar dans l'en-tte <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 est un itrateur de sortie en un seul passage qui crit les objets successifs de T type dans l'objet std::basic_ostream pour lequel il est construit, l'aide operator<<. En option dlimiteur est crit dans le flux de sortie aprs chaque opration d'criture. L'opration d'criture est effectue lorsque l'itrateur (si drfrenc ou non) est assign. L'incrmentation du std::ostream_iterator est 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.
You can help to correct and verify the translation. Click here for instructions.
Dans une mise en oeuvre typique, les donnes membres seulement de
std::ostream_iterator sont un pointeur sur le std::basic_ostream associ et un pointeur vers le premier caractre dans la chane de dlimiteur .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.
You can help to correct and verify the translation. Click here for instructions.
Lors de l'criture des caractres, std::ostreambuf_iterator est plus efficace, car elle permet d'viter la surcharge de la construction et de dtruire l'objet sentinelle fois par personnage .
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.
You can help to correct and verify the translation. Click here for instructions.
Types de membres
| Type du membre | Dfinition |
char_type
|
CharT
|
traits_type
|
Traits
|
ostream_type
|
std::basic_ostream<CharT, Traits>
|
Fonctions membres
construit un nouveau 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. (fonction membre publique) | |
Dtruit 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. (fonction membre publique) | |
crit un objet la squence de sortie associe 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. (fonction membre publique) | |
| no-op (fonction membre publique) | |
| no-op (fonction membre publique) | |
Inherited from std::iterator
Member types
| Type du membre | Dfinition |
value_type
|
void
|
difference_type
|
void
|
pointer
|
void
|
reference
|
void
|
iterator_category
|
std::output_iterator_tag
|
Exemple
#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, " "));
}
Rsultat :
0.1 0.3 0.6 1
Voir aussi
itrateur de sortie qui crit dans 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 gnrique) | |
itrateur d'entre qui lit 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 gnrique) | |