std::raw_storage_iterator
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <memory>
|
||
template< class OutputIt, class T > class raw_storage_iterator |
||
Il
std::raw_storage_iterator
iteratore di uscita rende possibile per gli algoritmi standard per memorizzare i risultati in memoria non inizializzata. Ogni volta che l'algoritmo scrive un oggetto di tipo T
all'iteratore dereferenziato, l'oggetto è copia-costruito nella posizione nella memoria non inizializzata a cui punta l'iteratore. Il OutputIt
parametro di modello è un qualsiasi tipo che soddisfi i requisiti di thee OutputIterator
e ha operator* definito per restituire un oggetto, per il quale operator& restituisce un oggetto di tipo T*
. Di solito, il T*
tipo viene utilizzato come 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.
Indice |
[modifica] Tipo requisiti
-OutputIt must meet the requirements of OutputIterator .
|
[modifica] Membri funzioni
crea un nuovo 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. (metodo pubblico) | |
restituisce un riferimento a questo 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. (metodo pubblico) | |
copia-costruisce un oggetto appuntito al-alla posizione nel 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. (metodo pubblico) | |
avanza l'iteratore 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. (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_type
|
void |
difference_type
|
void |
pointer
|
void |
reference
|
void |
iterator_category
|
std::output_iterator_tag |
[modifica] Esempio
#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); }
Output:
This is a test .
[modifica] Vedi anche
(C++11) |
fornisce informazioni sui tipi di allocatore Original: provides information about allocator types The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |
(C++11) |
implementa multilivello allocatore per contenitori multi-livello Original: implements multi-level allocator for multi-level containers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |
(C++11) |
controlla se il tipo specificato supporta usi-allocatore di costruzione Original: checks if the specified type supports uses-allocator construction The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |