The Wayback Machine - https://web.archive.org/web/20180613044140/http://ja.cppreference.com:80/w/cpp/concept/RandomAccessIterator
名前空間
変種
操作

C++ コンセプト: RandomAccessIterator

提供: cppreference.com
< cpp‎ | concept

 
 
 
RandomAccessIteratorは、一定時間内の任意の要素を指すように移動することができBidirectionalIteratorです.
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.
標準のポインタは、このコンセプトを満たす型の例です。.
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.

[編集]要件

上記の要件に加えて、型ItためRandomAccessIteratorされるためには、インスタンスがabir、と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.
ExpressionReturnEquivalent expressionNotes
r += nIt&if(n>=0)

   while(n--)++r;
else
   while(n++)--r;
return r;

  • nは、正または負の両方にすることができます
    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.
  • 一定の複雑さ(すなわち、同等の表現は実装として使用することはできません)
    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 + nItIt temp = i;

return temp += n;

n + iIti + n
r -= nIt&return r +=-n;
i - nItIt temp = i;

return temp -= n;

n - iIti - n
b - adifferencenreturns n such that a+n==b
i[n]convertible to reference*(i + n)
a < bcontextually convertible to boolb - a >0Strict total ordering relation:
  • !(a < a)
  • もしa < bその後!(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.
  • a < bいただくとb < cその後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またはb < aまたはa == b
    (正確に表現のいずれかに該当する)
    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 > bcontextually convertible to boolb < aTotal ordering relation opposite to a < b
a >= bcontextually convertible to bool!(a < b)
a <= bcontextually convertible to bool!(a > b)

[編集]表の注意事項

  • Itこの概念を実装している型です
    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タイプ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タイプ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タイプ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.
  • iab型のオブジェクトでItまたは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タイプ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タイプ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.
上記の規則はRandomAccessIteratorも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.
mutable RandomAccessiteratorはさらにBidirectionalIterator要件を満たし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.
close