C++11標準ライブラリのstd::move
関数テンプレートには、標準ヘッダ<utility>と<algorithm>とで用途の異なる2種類が存在する。
- ヘッダ<utility>の
move
- 変数(lvalue値)に対してムーブセマンティクスを適用するためのヘルパ関数。
- ヘッダ<algorithm>の
move
std::copy
アルゴリズムのmove版。InputIterator範囲とOutputIteratorの3引数をとる。
2021-10-05追記:C++2b(C++23)に向けた提案P2446R0にてstd::views::move
レンジアダプタ追加が予定されている。
// Header <utility> synopsis namespace std { // 20.2.3, forward/move: template <class T> typename remove_reference<T>::type&& move(T&&) noexcept; }
// Header <algorithm> synopsis namespace std { // 25.3.2, move: template<class InputIterator, class OutputIterator> OutputIterator move(InputIterator first, InputIterator last, OutputIterator result); }
関連URL
- cppreference utility - move, algorithm - move
- cpprefjp utility - move, algorithm - move