std::raw_storage_iterator
De cppreference.com
<metanoindex/>
<tbody> </tbody>| Definido no cabeçalho <memory>
|
||
template< class OutputIt, class T > class raw_storage_iterator : public std::iterator<std::output_iterator_tag, void, void, void, void>; |
||
O
std::raw_storage_iterator iterador de saída torna possível para algoritmos padrão para armazenar os resultados em memória não inicializada. Sempre que o algoritmo escreve um objeto de T tipo para o iterador dereferenced, o objeto é cópia construído no local do armazenamento não inicializado apontado pelo iterador. O OutputIt parâmetro do modelo é qualquer tipo que atenda aos requisitos de ti OutputIterator e tem operator* definida para retornar um objeto, para o qual operator& retorna um objeto do tipo T*. Normalmente, o T* tipo é utilizado como OutputIt.Original:
The output iterator
std::raw_storage_iterator makes it possible for standard algorithms to store results in uninitialized memory. Whenever the algorithm writes an object of type T to the dereferenced iterator, the object is copy-constructed into the location in the uninitialized storage pointed to by the iterator. The template parameter OutputIt is any type that meets thee requirements of OutputIterator and has operator* defined to return an object, for which operator& returns an object of type T*. Usually, the type T* is used as OutputIt.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.
Requisitos de tipo
-OutputIt must meet the requirements of OutputIterator.
|
Funções de membro
cria um novo raw_storage_iterator Original: creates a new raw_storage_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) | |
devolve uma referência a esta raw_storage_iterator Original: returns a reference to this raw_storage_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) | |
cópia constrói um objeto no local apontado para no buffer Original: copy-constructs an object at the pointed-to location in the buffer 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 o iterador Original: advances the 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) | |
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_type
|
void
|
difference_type
|
void
|
pointer
|
void
|
reference
|
void
|
iterator_category
|
std::output_iterator_tag
|
Exemplo
#include <iostream>
#include <string>
#include <memory>
#include <algorithm>
int main()
{
const std::string s[] = {"This", "is", "a", "test", "."};
std::string* p = std::get_temporary_buffer<std::string>(5).first;
std::copy(std::begin(s), std::end(s),
std::raw_storage_iterator<std::string*, std::string>(p));
for(std::string* i = p; i!=p+5; ++i) {
std::cout << *i << '\n';
i->~basic_string<char>();
}
std::return_temporary_buffer(p);
}
Saída:
This
is
a
test
.
