std::forward_list::splice_after
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> void splice_after(const_iterator pos, forward_list& other); |
(1) | (desde C++11) |
void splice_after(const_iterator pos, forward_list&& other); |
(1) | (desde C++11) |
void splice_after(const_iterator pos, forward_list& other, const_iterator it); |
(2) | (desde C++11) |
void splice_after(const_iterator pos, forward_list&& other, const_iterator it); |
(2) | (desde C++11) |
void splice_after(const_iterator pos, forward_list& other, const_iterator first, const_iterator last); |
(3) | (desde C++11) |
void splice_after(const_iterator pos, forward_list&& other, const_iterator first, const_iterator last); |
(3) | (desde C++11) |
Move elementos de outra
forward_list para *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.
Não há elementos são copiados.
pos é um iterador válido em *this ou é o iterador before_begin(). O comportamento é indefinido se get_allocator() != other.get_allocator(). Não iteradores ou referências tornam-se invalidado, os iteradores a elementos movidos agora se referem em *this, não em 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.
1)
Move todos os elementos de
other em *this. Os elementos são inseridos após o elemento apontado por pos. O other recipiente fica vazio após a operação. O comportamento é indefinido se 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.
2)
Move o elemento apontado por
it de other em *this. O elemento é inserido após o elemento apontado por 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.
3)
Move os elementos no intervalo de
(first, last) other em *this. Os elementos são inseridos após o elemento apontado por pos. O elemento apontado por first não é movido. O comportamento é indefinido se pos é um iterador no (first,last) gama.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.
Parâmetros
| pos | - | elemento, após o que o conteúdo vai ser inserido
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 | - | um outro recipiente para mover o conteúdo da
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 | - | o elemento de passar de
other para *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 | - | a gama de elementos para se deslocar de
other para *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. |
Valor de retorno
(Nenhum)
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.
Complexidade
1)
Linear no tamanho de
otherOriginal:
Linear in the size of
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.
2)
Constante
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.
3)
Linear em
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.
Exemplo
Demonstra o significado de intervalo aberto (primeira, a última) na terceira forma de splice_after (): o primeiro elemento de l1 não é movido .
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';
}
Saída:
1
10 2 3 4 5 11 12
Veja também
funde duas listas ordenadas 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. (função pública membro) | |
remove elementos que satisfazem critérios específicos 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. (função pública membro) | |