名前空間
変種
操作

std::move_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::istream_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.
move_iterator::move_iterator
move_iterator::operator=
move_iterator::base
move_iterator::operator*
move_iterator::operator->
move_iterator::operator[]
move_iterator::operator++
move_iterator::operator+
move_iterator::operator+=
move_iterator::operator--
move_iterator::operator-
move_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 move_iterator
(C + + 11以来)
std::move_iterator、まさに基礎とイテレータ(少なくともInputIteratorでなければなりません)のように振る舞うイテレータアダプタであることを除いて、右辺値参照解除に基礎反復子によって返された値を変換します。この反復子は入力反復子として使用されている場合、その効果は、値から移動ではなくコピーされているからです.
Original:
std::move_iterator is an iterator adaptor which behaves exactly like the underlying iterator (which must be at least an InputIterator), except that dereferencing converts the value returned by the underlying iterator into an rvalue. If this iterator is used as an input iterator, the effect is that the values are moved from, rather than copied from.
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 Iterator
value_type std::iterator_traits<Iterator>::value_type
iterator_category std::iterator_traits<Iterator>::iterator_category
reference value_type&&

[編集] メンバ関数

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

[編集]

#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <numeric>
int main()
{
    std::vector<std::string> v{"this", "is", "an", "example"};
 
    std::cout << "Old contents of the vector: ";
    for(auto& s : v)
        std::cout << '"' << s << "\" ";
 
    typedef std::vector<std::string>::iterator iter_t;
    std::string concat = std::accumulate(
                             std::move_iterator<iter_t>(v.begin()),
                             std::move_iterator<iter_t>(v.end()),
                             std::string());  // Can be simplified with std::make_move_iterator
 
    std::cout << "\nConcatenated as string: " << concat << '\n'
              << "New contents of the vector: ";
    for(auto& s : v)
        std::cout << '"' << s << "\" ";
    std::cout << '\n';
}

Output:

Old contents of the vector: "this" "is" "an" "example"
Concatenated as string: thisisanexample
New contents of the vector: "" "" "" ""

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

引数から推論された型のstd::move_iteratorを作成します
Original:
creates a std::move_iterator of type inferred from the argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

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