◐ Shell
clean mode source ↗

C + + Konzepte: RandomAccessIterator – cppreference.com

Aus cppreference.com

<metanoindex/>

A RandomAccessIterator ist ein BidirectionalIterator, die verschoben, um jedes Element in konstanter Zeit zeigen können .

Original:

A RandomAccessIterator is a BidirectionalIterator that can be moved to point to any element in constant time.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Ein Standard-Zeiger ist ein Beispiel eines Typs, die dieses Konzept erfüllt .

Original:

A standard pointer is an example of a type that satisfies this concept.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Anforderungen

Zusätzlich zu der Anforderung für einen Typ It ein RandomAccessIterator sein, Instanzen a, b muss i und r von It:

Original:

In addition to the above requirement, for a type It to be an RandomAccessIterator, instances a, b, i, and r of It must:

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Expression Return Equivalent expression Notes
r += n It& if(n>=0) while(n--) ++r; else while(n++) --r; return r;
  • n kann sowohl positiv oder negativ sein

    Original:

    n can be both positive or negative

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • Constant Komplexität (dh, der entsprechende Ausdruck kann nicht als Umsetzung verwendet werden)

    Original:

    Constant complexity (that is, the equivalent expression cannot be used as implementation)

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

i + n It It temp = i; return temp += n;
n + i It i + n
r -= n It& return r += -n;
i - n It It temp = i; return temp -= n;
n - i It i - n
b - a difference n returns n such that a+n==b
i[n] convertible to reference *(i + n)
a < b contextually convertible to bool b - a > 0 Strict total ordering relation:
  • !(a < a)
  • wenn a < b dann !(b < a)

    Original:

    if a < b then !(b < a)

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • wenn a < b und b < c dann a < c

    Original:

    if a < b and b < c then a < c

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • a < b oder b < a oder a == b
    (genau einer der Ausdrücke wahr ist)

    Original:

    a < b or b < a or a == b
    (exactly one of the expressions is true)

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

a > b contextually convertible to bool b < a Total ordering relation opposite to a < b
a >= b contextually convertible to bool !(a < b)
a <= b contextually convertible to bool !(a > b)

Anmerkungen zur Tabelle

  • It ist die Art der Umsetzung dieses Konzepts

    Original:

    It is the type implementing this concept

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • T ist die Art std::iterator_traits<It>::value_type

    Original:

    T is the type std::iterator_traits<It>::value_type

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • reference ist die Art std::iterator_traits<It>::reference

    Original:

    reference is the type std::iterator_traits<It>::reference

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • difference ist die Art std::iterator_traits<It>::difference_type

    Original:

    difference is the type std::iterator_traits<It>::difference_type

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • i, a, b sind Objekte vom Typ It oder const It

    Original:

    i, a, b are objects of type It or const It

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • r ist ein Wert vom Typ It&

    Original:

    r is a value of type It&

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • n eine ganze Zahl von Typ difference

    Original:

    n is an integer of type difference

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

Die oben genannten Regeln bedeuten, dass RandomAccessIterator implementiert auch LessThanComparable .

Original:

The above rules imply that RandomAccessIterator also implements LessThanComparable.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

A mutable RandomAccessiterator ist ein BidirectionalIterator, die zusätzlich erfüllt die OutputIterator Anforderungen .

Original:

A mutable RandomAccessiterator is a BidirectionalIterator that additionally satisfies the OutputIterator requirements.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.