std::reverse_iterator
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. |
definiert in Header <iterator>
|
||
template< class Iterator > class reverse_iterator : public std::iterator< |
||
std::reverse_iterator
ist ein Iterator-Adapter, die die Richtung eines gegebenen Iterator umkehrt. Mit anderen Worten, wenn es mit einem bidirektionalen Iterator vorgesehen ist, erzeugt einen neuen std::reverse_iterator
Iterator, der vom Ende bewegt sich zum Beginn der Sequenz von der zugrundeliegenden bidirektionalen Iterator definiert .Original:
std::reverse_iterator
is an iterator adaptor that reverses the direction of a given iterator. In other words, when provided with a bidirectional iterator, std::reverse_iterator
produces a new iterator that moves from the end to the beginning of the sequence defined by the underlying bidirectional iterator.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.
Für einen umgekehrten Iterator
r
aus einem Iterator i
gebaut, ist die Beziehung &*r == &*(i-1) immer wahr, so ein Reverse-Iterator hergestellt aus einem ein-past-the-end iterator dereferences auf das letzte Element in einer Sequenz . Original:
For a reverse iterator
r
constructed from an iterator i
, the relationship &*r == &*(i-1) is always true; thus a reverse iterator constructed from a one-past-the-end iterator dereferences to the last element in a sequence. 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.
Dies ist der Iterator um Elementfunktionen
rbegin()
und rend()
der Standard-Bibliothek Container zurückgegeben .Original:
This is the iterator returned by member functions
rbegin()
and rend()
of the standard library containers.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.
Inhaltsverzeichnis |
[Bearbeiten] Mitglied Typen
Mitglied Typ
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
iterator_type
|
Iterator
|
difference_type
|
std::iterator_traits<Iterator>::difference_type |
pointer
|
std::iterator_traits<Iterator>::pointer |
reference
|
std::iterator_traits<Iterator>::reference |
[Bearbeiten] Member-Funktionen
baut einen neuen Iterator-Adapter Original: constructs a new iterator adaptor The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
ordnet eine andere Iterator Original: assigns another iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
greift auf die zugrunde liegenden Iterator Original: accesses the underlying iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
greift auf die spitzen-to-Element Original: accesses the pointed-to element The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
erhält rvalue Bezug auf indizierte Element Original: obtains rvalue reference to indexed element The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Vorschüsse oder dekrementiert den Iterator Original: advances or decrements the iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) |
[Bearbeiten] Mitglied widerspricht
Member name
Original: Member name The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
current (geschützt)
|
eine Kopie des base () Iterator
Original: a copy of the base() iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Zusätzlich zu dem aktuellen Wert des zugrundeliegenden Iterator, hält eine typische Implementierung eines
std::reverse_iterator
dekrementiert Kopie des zugrundeliegenden Iterator, der in Dereferenzieren verwendet wird .Original:
In addition to the current value of the underlying iterator, a typical implementation of
std::reverse_iterator
holds a decremented copy of the underlying iterator, which is used in dereferencing.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.
[Bearbeiten] Non-Member-Funktionen
vergleicht die zugrunde liegenden Iteratoren Original: compares the underlying iterators The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktions-Template) | |
Fortschritte der Iterator Original: advances the iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktions-Template) | |
berechnet den Abstand zwischen zwei Iterator Adaptern Original: computes the distance between two iterator adaptors The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktions-Template) |
Inherited from std::iterator
Member types
Mitglied Typ
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
std::iterator_traits<Iterator>::value_type |
difference_type
|
std::iterator_traits<Iterator>::difference_type |
pointer
|
std::iterator_traits<Iterator>::pointer |
reference
|
std::iterator_traits<Iterator>::reference |
iterator_category
|
std::iterator_traits<Iterator>::iterator_category |
[Bearbeiten] Beispiel
#include <iostream> #include <string> #include <iterator> int main() { std::string s = "Hello, world"; std::reverse_iterator<std::string::iterator> r = s.rbegin(); r[7] = 'O'; // replaces 'o' with 'O' r += 7; // iterator now points at 'O' std::string rev(r, s.rend()); std::cout << rev << '\n'; }
Output:
OlleH
[Bearbeiten] Siehe auch
die grundlegende Iterator Original: the basic iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Klassen-Template) |