operator+(std::move_iterator)

来自cppreference.com


 
 
迭代器库
迭代器概念
迭代器原语
算法概念与工具
间接可调用概念
常用算法要求
(C++20)
(C++20)
(C++20)
工具
(C++20)
迭代器适配器
范围访问
(C++11)(C++14)
(C++14)(C++14)  
(C++11)(C++14)
(C++14)(C++14)  
(C++17)(C++20)
(C++17)
(C++17)
 
 
在标头 <iterator> 定义
template< class Iter >

move_iterator<Iter> operator+
    ( typename move_iterator<Iter>::difference_type n,

      const move_iterator<Iter>& it );
(C++11 起)
(C++17 起为 constexpr)
(C++20 前)
template< class Iter >

constexpr move_iterator<Iter> operator+

    ( std::iter_difference_t<Iter> n, const move_iterator<Iter>& it );
(C++20 起)

返回增加了 n 的迭代器 it

此重载只有在 it.base() + n 良构并且类型是 Iter 时才会参与重载决议。

(C++20 起)

目录

[编辑] 参数

n - 迭代器所要增加的位置数
it - 要增加的迭代器适配器

[编辑] 返回值

it + n

[编辑] 示例

[编辑] 缺陷报告

���列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。

缺陷报告 应用于 出版时的行为 正确行为
LWG 3293 C++20 非成员 operator+ 被约束为要求 it + n 良构并且类型是 Iter 改为 it.base() + n

[编辑] 参阅

推进或回退 move_iterator
(公开成员函数) [编辑]
(C++11)
计算两个迭代器适配器间的距离
(函数模板) [编辑]