名前空間
変種
操作

std::make_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
make_move_iterator(C++11)
back_inserter
front_inserter
inserter
ストリーム反復子
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)
 
Defined in header <iterator>
template< class Iterator >
std::move_iterator<Iterator> make_move_iterator( const Iterator& i );
(C++11およびそれ以降)
make_move_iterator引数の型から推論型で与えられたイテレータstd::move_iteratoriを構築するための便利な関数テンプレートです.
Original:
make_move_iterator is a convenience function template that constructs a std::move_iterator for the given iterator i with the type deduced from the type of the argument.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

i -
入力イテレータは、イテレータを移動するために変換される
Original:
input iterator to be converted to move iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

std::move_iteratorを介してアクセスする要素から移動するために使用することができi
Original:
A std::move_iterator which can be used to move from the elements accessed through i
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 可能な実装

template< class Iterator >
std::move_iterator<Container> make_move_iterator( const Iterator& i)
{
    return std::move_iterator<Iterator>(i);
}

[編集]

#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <iterator>
int main()
{
    std::list<std::string> s{"one", "two", "three"};
 
    std::vector<std::string> v1(s.begin(), s.end()); // copy
 
    std::vector<std::string> v2(std::make_move_iterator(s.begin()),
                                std::make_move_iterator(s.end())); // move
 
    std::cout << "v1 now holds: ";
    for(auto str : v1)
            std::cout << "\"" << str << "\" ";
    std::cout << "\nv2 now holds: ";
    for(auto str : v2)
            std::cout << "\"" << str << "\" ";
    std::cout << "\noriginal list now holds: ";
    for(auto str : s)
            std::cout << "\"" << str << "\" ";
    std::cout << '\n';
}

Output:

v1 now holds: "one" "two" "three"
v2 now holds: "one" "two" "three"
original list now holds: "" "" ""

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

その右辺値参照に間接参照イテレータアダプタ
Original:
iterator adaptor which dereferences to an rvalue reference
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(クラステンプレート) [edit]
(C++11)
右辺値参照を取得します
Original:
obtains an rvalue reference
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

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