C + +: conceitos<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">C++ concepts:</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> RandomAccessIterator - cppreference.com">C + +: conceitos<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">C++ concepts:</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> RandomAccessIterator - cppreference.com">
close
Espaços nominais
Variantes
Ações

<div class="t-tr-text">C + +: conceitos<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">C++ concepts:</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> RandomAccessIterator

De cppreference.com

<metanoindex/>

 
 
C + + conceitos
Basic
Original:
Basic
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Biblioteca-Wide
Original:
Library-Wide
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Container
Original:
Container
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Elementos de contêineres
Original:
Container Elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Iterator
Original:
Iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Números aleatórios
Original:
Random Numbers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Simultaneidade
Original:
Concurrency
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
Outro
Original:
Other
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
A RandomAccessIterator é um BidirectionalIterator que pode ser movido para apontar para qualquer elemento em tempo constante.
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.
Um ponteiro de tipo é um exemplo de um tipo que satisfaça este conceito.
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.

Requisitos

Além do requisito acima, para um tipo It ser um RandomAccessIterator, instâncias a, b, i, r e de It deve:
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 tanto pode ser positivo ou negativo
    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.
  • Complexidade constante (isto é, a expressão equivalente, não pode ser usado como a aplicação)
    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)
  • se a < b então !(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.
  • se a < b e b < c então 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 ou b < a ou a == b
    (exatamente uma das expressões é verdadeira)
    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)

Notas de mesa

  • It é o tipo de aplicação deste conceito
    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 é o std::iterator_traits<It>::value_type tipo
    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 é o std::iterator_traits<It>::reference tipo
    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 é o std::iterator_traits<It>::difference_type tipo
    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 são objetos do tipo It ou 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 é um valor de It& tipo
    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 é um número inteiro de difference tipo
    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.
As regras acima implica que RandomAccessIterator também implementa 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 é um BidirectionalIterator que, adicionalmente, satisfaz os requisitos OutputIterator.
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.