std::forward_list::splice_after
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. |
<metanoindex/>
<tbody> </tbody> void splice_after(const_iterator pos, forward_list& other); |
(1) | (dal C++11) |
void splice_after(const_iterator pos, forward_list&& other); |
(1) | (dal C++11) |
void splice_after(const_iterator pos, forward_list& other, const_iterator it); |
(2) | (dal C++11) |
void splice_after(const_iterator pos, forward_list&& other, const_iterator it); |
(2) | (dal C++11) |
void splice_after(const_iterator pos, forward_list& other, const_iterator first, const_iterator last); |
(3) | (dal C++11) |
void splice_after(const_iterator pos, forward_list&& other, const_iterator first, const_iterator last); |
(3) | (dal C++11) |
Sposta gli elementi da un altro
forward_list a *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.
Non ci sono elementi vengono copiati.
pos è un iteratore valido in *this o è l'iteratore before_begin(). Il comportamento è indefinito se get_allocator() != other.get_allocator(). Non iteratori o riferimenti diventano invalidata, gli iteratori ad elementi spostati ora si riferiscono in *this, non in 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)
Sposta tutti gli elementi da
other in *this. Gli elementi sono inseriti dopo l'elemento puntato da pos. Il other contenitore si svuota dopo l'operazione. Il comportamento è indefinito 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)
Sposta l'elemento puntato da
it da other in *this. L'elemento viene inserito dopo l'elemento puntato da 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)
Consente di spostare gli elementi della gamma
(first, last) da other in *this. Gli elementi sono inseriti dopo l'elemento puntato da pos. L'elemento ha a da first non viene spostato. Il comportamento è indefinito se pos è un iteratore nel (first,last) gamma.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.
Parametri
| pos | - | elemento dopo il quale il contenuto verrà inserito
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 altro contenitore per spostare il contenuto
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'elemento di passare da
other a *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 gamma di elementi per passare da
other a *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. |
Valore di ritorno
(Nessuno)
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.
Complessità
1)
Lineare nella dimensione di
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)
Constant
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)
Lineare in
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.
Esempio
Viene illustrato il significato di intervallo aperto (primo, ultimo) nella terza forma di splice_after (): il primo elemento di L1 non viene spostata .
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';
}
Output:
1
10 2 3 4 5 11 12
Vedi anche
fonde due liste ordinate 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. (metodo pubblico) | |
rimuove gli elementi che soddisfano criteri specifici 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. (metodo pubblico) | |