名前空間
変種
操作

std::reverse_iterator

提供: cppreference.com
< cpp‎ | iterator

 
 
イテレータライブラリ
イテレータプリミティブ
Original:
Iterator primitives
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iterator_traits
input_iterator_tag
output_iterator_tag
forward_iterator_tag
bidirectional_iterator_tag
random_access_iterator_tag
iterator
イテレータアダプタ
Original:
Iterator adaptors
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
reverse_iterator
ストリーム反復子
Original:
Stream iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istream_iterator
ostream_iterator
istreambuf_iterator
ostreambuf_iterator
イテレータ操作
Original:
Iterator operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
advance
distance
prev(C++11)
next(C++11)
アクセスの範囲
Original:
Range access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
begin(C++11)
end(C++11)
 
std::reverse_iterator
メンバ関数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
reverse_iterator::reverse_iterator
reverse_iterator::operator=
reverse_iterator::base
reverse_iterator::operator*
reverse_iterator::operator->
reverse_iterator::operator[]
reverse_iterator::operator++
reverse_iterator::operator+
reverse_iterator::operator+=
reverse_iterator::operator--
reverse_iterator::operator-
reverse_iterator::operator-=
非メンバ関数
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator==
operator!=
operator<
operator>
operator+
operator-
 
Defined in header <iterator>
template< class Iterator >

class reverse_iterator : public std::iterator<
                           typename std::iterator_traits<Iterator>::iterator_category,
                           typename std::iterator_traits<Iterator>::value_type,
                           typename std::iterator_traits<Iterator>::difference_type,
                           typename std::iterator_traits<Iterator>::pointer,

                           typename std::iterator_traits<Iterator>::reference >
std::reverse_iterator与え​​られたイテレータの方向を逆にイテレータアダプタです。換言すれば、双方向の反復が提供されると、std::reverse_iteratorは、基礎となる双方向の反復子によって定義されたシーケンスの先頭に端から移動新しいイテレータを生成.
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.
イテレータrから構築リバースイテレータiについては、関係&*r == &*(i-1)は常にtrueであり、従ってワン終了反復子を間接参照からシーケンスの最後の要素に建設リバースイテレータ.
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.
これはrbegin()rend()標準ライブラリコンテナのメンバ関数によって返される反復子です.
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.

目次

[編集] メンバータイプ

メンバー·タイプ
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

[編集] メンバ関数

新しいイテレータアダプタを構築します
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.

(パブリックメンバ関数) [edit]
別のイテレータを割り当てます
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.

(パブリックメンバ関数) [edit]
基礎イテレータにアクセスします
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.

(パブリックメンバ関数) [edit]
尖ったトゥ要素にアクセスします
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.

(パブリックメンバ関数) [edit]
インデックス要素に右辺値参照を取得します
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.

(パブリックメンバ関数) [edit]
進歩またはデクリメントイテレータ
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.

(パブリックメンバ関数) [edit]

[編集] メンバーオブジェクト

メンバー名
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 (保護されています)
ベース()反復子のコピー
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.
基礎イテレータの現在の値に加えて、std::reverse_iteratorの一般的な実装は、間接参照に使用される配下のイテレータ、デクリメントのコピーを保持しています.
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.

[編集] 非メンバ関数

基礎の反復子を比較します
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.

(関数テンプレート) [edit]
進歩イテレータ
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.

(関数テンプレート) [edit]
2イテレータアダプタ間の距離を計算します
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.

(関数テンプレート) [edit]

Inherited from std::iterator

Member types

メンバー·タイプ
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

[編集]

#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

[編集] も参照してください

基本的なイテレータ
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.

(クラステンプレート) [edit]