std::forward_list::splice_after
Aus 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) | (seit C++11) |
void splice_after(const_iterator pos, forward_list&& other); |
(1) | (seit C++11) |
void splice_after(const_iterator pos, forward_list& other, const_iterator it); |
(2) | (seit C++11) |
void splice_after(const_iterator pos, forward_list&& other, const_iterator it); |
(2) | (seit C++11) |
void splice_after(const_iterator pos, forward_list& other, const_iterator first, const_iterator last); |
(3) | (seit C++11) |
void splice_after(const_iterator pos, forward_list&& other, const_iterator first, const_iterator last); |
(3) | (seit C++11) |
Moves Elemente aus anderen
forward_list um *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.
Keine Elemente kopiert werden.
pos ist ein gültiger Iterator *this oder ist das before_begin() Iterator. Das Verhalten ist, wenn get_allocator() != other.get_allocator() undefiniert. Keine Iteratoren oder Referenzen geworden ungültig, die Iteratoren bewegte Elemente beziehen sich nun in *this, nicht 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)
Verschiebt alle Elemente aus
other in *this. Die Elemente eingefügt sind, nachdem das Element auf den durch pos. Der Behälter other leer nach der Operation. Das Verhalten ist, wenn this == &other undefiniertOriginal:
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)
Verschiebt das Element, auf das
it von other in *this. Das Element eingesetzt ist, nachdem das Element auf den durch 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)
Verschiebt die Elemente im Bereich
(first, last) von other in *this. Die Elemente eingefügt sind, nachdem das Element auf den durch pos. Das Element wies Beträge von first wird nicht bewegt. Das Verhalten ist undefiniert, wenn pos ein Iterator im Bereich (first,last) ist .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.
Parameter
| pos | - | Element nach dem der Inhalt eingefügt werden
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 | - | ein weiterer Container, um den Inhalt zu verschieben
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 | - | das Element aus
other um *this bewegenOriginal: 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 | - | der Bereich von Elementen aus
other um *this bewegenOriginal: 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. |
Rückgabewert
(None)
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.
Komplexität
1)
Linear in der Größe
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)
Linear 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.
Beispiel
Veranschaulicht die Bedeutung der offenen Intervall (ersten, letzten) in der dritten Form splice_after (): das erste Element des l1 nicht bewegt wird .
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
Siehe auch
| vereinigt zwei sortierte Listen (öffentliche Elementfunktion) | |
| entfernt Elemente anhand bestimmter Kriterien (öffentliche Elementfunktion) | |