Namensräume
Varianten

std::reverse_copy

Aus cppreference.com
< cpp‎ | algorithm

 
 
Algorithm Bibliothek
Funktionen
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Nicht-modifizierende Sequenz Operationen
Original:
Non-modifying sequence operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Modifizierende Sequenz Operationen
Original:
Modifying sequence operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Partitionierungsoperationen
Original:
Partitioning operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Sortierung Operationen (auf sortierten Bereiche)
Original:
Sorting operations (on sorted ranges)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Binary Suchaktionen (auf sortierten Bereiche)
Original:
Binary search operations (on sorted ranges)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Set-Operationen (auf sortierten Bereiche)
Original:
Set operations (on sorted ranges)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Heap-Operationen
Original:
Heap operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Minimum / Maximum Operationen
Original:
Minimum/maximum operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Numerische Operationen
Original:
Numeric operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
C-Bibliothek
Original:
C library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
definiert in Header <algorithm>
template<class BidirIt, class OutputIt >
OutputIt reverse_copy( BidirIt first, BidirIt last, OutputIt d_first );
Kopiert die Elemente aus dem Bereich [first, last), in einen anderen Bereich beginnend bei d_first in einer solchen Weise, dass die Elemente in der neuen Reihe sind in .. umgekehrter Reihenfolge .
Original:
Copies the elements from the range [first, last), to another range beginning at d_first in such a way, that the elements in the new range are in reverse order.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten]Parameter

first, last -
der Bereich der zu kopierenden Elemente
Original:
the range of elements to copy
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
d_first -
der Beginn des Zielbereichs
Original:
the beginning of the destination range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Type requirements
-
BidirIt must meet the requirements of BidirectionalIterator.
-
OutputIt must meet the requirements of OutputIterator.

[Bearbeiten]Rückgabewert

Output Iterator auf das Element nach dem letzten Element kopiert .
Original:
Output iterator to the element past the last element copied.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten]Mögliche Implementierung

template<class BidirIt, class OutputIt> OutputIt reverse_copy(BidirIt first, BidirIt last, OutputIt d_first){while(first != last){*(d_first++)=*(--last);}return d_first;}

[Bearbeiten]Beispiel

#include <vector>#include <iostream>#include <algorithm>   int main(){std::vector<int> v({1,2,3});std::for_each(std::begin(v), std::end(v), [&](int value){std::cout<< value <<" ";});std::cout<<std::endl;   std::vector<int> destiny(3); std::reverse_copy(std::begin(v), std::end(v), std::begin(destiny));std::for_each(std::begin(destiny), std::end(destiny), [&](int value){std::cout<< value <<" ";});std::cout<<std::endl;}

Output:

1 2 3 3 2 1

[Bearbeiten]Komplexität

linear im Abstand first und last
Original:
linear in the distance between first and last
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten]Siehe auch

Kehrt die Reihenfolge Elemente in einem Bereich
Original:
reverses the order elements in a range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template)[edit]
close