std::forward_list::splice_after
De cppreference.com
< cpp | container | forward list
![]() |
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. |
void splice_after(const_iterator pos, forward_list& other); |
(1) | (depuis C++11) |
void splice_after(const_iterator pos, forward_list&& other); |
(1) | (depuis C++11) |
void splice_after(const_iterator pos, forward_list& other, const_iterator it); |
(2) | (depuis C++11) |
void splice_after(const_iterator pos, forward_list&& other, const_iterator it); |
(2) | (depuis C++11) |
void splice_after(const_iterator pos, forward_list& other, const_iterator first, const_iterator last); |
(3) | (depuis C++11) |
void splice_after(const_iterator pos, forward_list&& other, const_iterator first, const_iterator last); |
(3) | (depuis C++11) |
Déplace les éléments d'un autre
forward_list
à *this .Original:
Moves elements from another
forward_list
to *this.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.
Aucun élément n'est copié.
1) pos
est un itérateur valide *this ou l'itérateur before_begin(). Le comportement est indéfini si get_allocator() != other.get_allocator(). Pas itérateurs ou les références deviennent invalidé, les itérateurs aux éléments déplacés maintenant se référer à *this, pas dans other
.Original:
No elements are copied.
pos
is a valid iterator in *this or is the before_begin() iterator. The behavior is undefined if get_allocator() != other.get_allocator(). No iterators or references become invalidated, the iterators to moved elements now refer into *this, not into other
.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.
Déplace tous les éléments de
2) other
en *this. Les éléments suivants sont insérés après l'élément pointé par pos
. Le other
récipient est vide après l'opération. Le comportement est indéfini si this == &otherOriginal:
Moves all elements from
other
into *this. The elements are inserted after the element pointed to by pos
. The container other
becomes empty after the operation. The behavior is undefined if this == &otherThe 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.
Déplace l'élément pointé par
3) it
de other
en *this. L'élément est inséré après l'élément pointé par pos
.Original:
Moves the element pointed to by
it
from other
into *this. The element is inserted after the element pointed to by pos
.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.
Déplace les éléments de la gamme
(first, last)
de other
en *this. Les éléments suivants sont insérés après l'élément pointé par pos
. L'élément pointé par-first
n'est pas déplacé. Le comportement est indéfini si pos
est un itérateur dans le (first,last)
plage .Original:
Moves the elements in the range
(first, last)
from other
into *this. The elements are inserted after the element pointed to by pos
. The element pointed-to by first
is not moved. The behavior is undefined if pos
is an iterator in the range (first,last)
.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.
Sommaire |
[modifier] Paramètres
pos | - | élément après lequel le contenu sera inséré
Original: element after which the content will be inserted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
other | - | un autre récipient pour déplacer le contenu de
Original: another container to move the content from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
it | - | l'élément à se déplacer d'
other à *thisOriginal: the element to move from other to *thisThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
first, last | - | la plage d'éléments pour passer d'
other à *thisOriginal: the range of elements to move from other to *thisThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifier] Retourne la valeur
(Aucun)
Original:
(none)
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.
[modifier] Complexité
1)Linéaire en la taille de
2) other
Original:
Linear in the size of
other
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.
Constante
3) Original:
Constant
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.
Linéaire dans std::distance(first, last)
Original:
Linear in std::distance(first, last)
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.
[modifier] Exemple
Démontre le sens de l'intervalle ouvert (first, last) dans la troisième forme de splice_after (): le premier élément de l1 n'est pas déplacé .
Original:
Demonstrates the meaning of open interval (first, last) in the third form of splice_after(): the first element of l1 is not moved.
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.
#include <iostream> #include <forward_list> int main() { std::forward_list<int> l1 = {1,2,3,4,5}; std::forward_list<int> l2 = {10,11,12}; l2.splice_after(l2.cbegin(), l1, l1.cbegin(), l1.cend()); // not equivalent to l2.splice_after(l2.cbegin(), l1); for(int n : l1) std::cout << n << ' '; std::cout << '\n'; for(int n : l2) std::cout << n << ' '; std::cout << '\n'; }
Résultat :
1 10 2 3 4 5 11 12
[modifier] Voir aussi
fusionne deux listes triées Original: merges two sorted lists 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) | |
supprime des éléments répondant à des critères spécifiques Original: removes elements satisfying specific criteria 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) |