std::front_insert_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 Container > class front_insert_iterator : public std::iterator< std::output_iterator_tag, void,void,void,void > |
||
std::front_insert_iterator est un itrateur de sortie qui est prcde d'lments dans un conteneur pour lequel il a t construit, en utilisant la fonction du conteneur push_front() membre lorsque l'itrateur (que ce soit drfrenc ou non) est assign. L'incrmentation du std::front_insert_iterator est un no-op .Original:
std::front_insert_iterator is an output iterator that prepends elements to a container for which it was constructed, using the container's push_front() member function whenever the iterator (whether dereferenced or not) is assigned to. Incrementing the std::front_insert_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.
Types de membres
| Type du membre | Dfinition |
container_type
|
Container
|
Fonctions membres
Modle:cpp/iterator/inserter/dsc operator++ construit un nouveau front_insert_iterator Original: constructs a new front_insert_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) | |
insre un objet dans le rcipient associ Original: inserts an object into the associated container 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) | |
Objets membres
Nom du membre
Original: Member name The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
container (protge )
Original: protected The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
un pointeur de
Container* type Original: a pointer of type Container* The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
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 <vector>
#include <deque>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
std::vector<int> v{1,2,3,4,5};
std::deque<int> d;
std::copy(v.begin(), v.end(),
std::front_insert_iterator<std::deque<int>>(d)); // or std::front_inserter(d)
for(int n : d)
std::cout << n << ' ';
std::cout << '\n';
}
Rsultat :
5 4 3 2 1
Voir aussi
cre un std::front_insert_iterator de type infr partir de l'argument Original: creates a std::front_insert_iterator of type inferred from the argument The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction gnrique) | |
Adaptateur itrateur pour l'insertion la fin d'un rcipient Original: iterator adaptor for insertion at the end of a container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe gnrique) | |
Adaptateur itrateur pour l'insertion dans un rcipient Original: iterator adaptor for insertion into a container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe gnrique) | |