Espaços nominais
Variantes
Acções

std::istreambuf_iterator

Da cppreference.com
< cpp‎ | iterator

 
 
Biblioteca Iterator
Primitivas iterador
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.
Adaptadores de iterador
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.
Iteradores fluxo
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.
istreambuf_iterator
Operações iterador
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.
(C++11)
(C++11)
Variar de acesso
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.
(C++11)
(C++11)
 
std::istreambuf_iterator
Funções de membro
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.
istreambuf_iterator::istreambuf_iterator
istreambuf_iterator::operator*
istreambuf_iterator::operator->

(C++11)
istreambuf_iterator::operator++
istreambuf_iterator::operator++(int)
istreambuf_iterator::equal
Não-membros funções
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
Definido no cabeçalho <iterator>
template<class CharT, class Traits =std::char_traits<CharT>>

class istreambuf_iterator :publicstd::iterator<std::input_iterator_tag,
                                                  CharT,
                                                  typename Traits::off_type,
                                                  /* unspecified, usually CharT* */,

                                                  CharT >
std::istreambuf_iterator é um iterador de entrada de passagem única, que lê os caracteres sucessivos a partir do objecto std::basic_streambuf para o qual foi construído. A operação de leitura actual é executada quando o iterador é incrementado, e não quando é dereferenced. O primeiro caractere pode ser lido quando o iterador é construído ou quando o dereferencing primeiro é feito. Caso contrário, dereferencing só retorna uma cópia do personagem mais recentemente li.
Original:
std::istreambuf_iterator is a single-pass input iterator that reads successive characters from the std::basic_streambuf object for which it was constructed. The actual read operation is performed when the iterator is incremented, not when it is dereferenced. The first character may be read when the iterator is constructed or when the first dereferencing is done. Otherwise, dereferencing only returns a copy of the most recently read character.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
O padrão construído std::istreambuf_iterator é conhecido como o fim-de-fluxo iterador. Quando um std::istreambuf_iterator válido atinge o final do fluxo de base, torna-se igual ao iterador fim-de-fluxo. Dereferencing ou incrementá-lo ainda mais invoca comportamento indefinido.
Original:
The default-constructed std::istreambuf_iterator is known as the end-of-stream iterator. When a valid std::istreambuf_iterator reaches the end of the underlying stream, it becomes equal to the end-of-stream iterator. Dereferencing or incrementing it further invokes undefined behavior.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::istreambuf_iterator tem um construtor de cópia trivial, um construtor padrão constexpr, e um destruidor trivial.
Original:
std::istreambuf_iterator has a trivial copy constructor, a constexpr default constructor, and a trivial destructor.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar]Tipos de membro

Tipo de membro
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
int_typetypename traits::int_type
streambuf_typestd::basic_streambuf<CharT, Traits>
istream_typestd::basic_istream<CharT, Traits>

[editar]Funções de membro

constrói um novo istreambuf_iterator
Original:
constructs a new istreambuf_iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro)
(destructor)
(declarada implicitamente)
destructs an istreambuf_iterator
(função pública membro)
obtém uma cópia do atual character
accesses um membro do personagem atual, se CharT tem membros
Original:
obtains a copy of the current character
accesses a member of the current character, if CharT has members
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro)
avança a istreambuf_iterator
Original:
advances the istreambuf_iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro)
se ambos os testes são istreambuf_iterators fim-de-stream ou se ambos são válidos
Original:
tests if both istreambuf_iterators are end-of-stream or if both are valid
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro)

[editar]Não-membros funções

compara dois istreambuf_iterators
Original:
compares two istreambuf_iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(modelo de função)

Herdado de std::iterator

Member types

Tipo de membro
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_typeCharT
difference_typeTraits::off_type
pointer/* unspecified, usually CharT* */
referenceCharT
iterator_categorystd::input_iterator_tag

[editar]Exemplo

#include <vector>#include <sstream>#include <iostream>#include <iterator>int main(){// typical use case: an input stream represented as a pair of iteratorsstd::istringstream in("Hello, world");std::vector<char> v((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());std::cout<<"v has "<< v.size()<<" bytes. "; v.push_back('\0');std::cout<<"it holds \""<<&v[0]<<"\"\n";     // demonstration of the single-pass naturestd::istringstream s("abc"); std::istreambuf_iterator<char> i1(s), i2(s);std::cout<<"i1 returns "<<*i1 <<'\n'<<"i2 returns "<<*i2 <<'\n';++i1;std::cout<<"after incrementing i1, but not i2\n"<<"i1 returns "<<*i1 <<'\n'<<"i2 returns "<<*i2 <<'\n';++i2;// this makes the apparent value of *i2 to jump from 'a' to 'c'std::cout<<"after incrementing i2, but not i1\n"<<"i1 returns "<<*i1 <<'\n'<<"i2 returns "<<*i2 <<'\n';   }

Saída:

v has 12 bytes. it holds "Hello, world" i1 returns a i2 returns a after incrementing i1, but not i2 i1 returns b i2 returns a after incrementing i2, but not i1 i1 returns b i2 returns c

[editar]Veja também

iterador de saída que escreve para 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.

(modelo de classe)[edit]
iterador de entrada que lê 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.

(modelo de classe)[edit]
close