CppDS.com

C++ 98 11 14 17 20 手册

实验性库头文件 <experimental/ranges/iterator>

来自cppreference.com
< cpp‎ | header‎ | experimental
 
 
 
实验性库头文件
文件系统 TS
<experimental/filesystem>
并行 TS (v1, v2)
库基础 TS (v1, v2, v3)
并发 TS
范围 TS
协程 TS
<experimental/coroutine>
网络 TS
反射 TS
<experimental/reflect>
 

此头文件是范围库的一部分。

迭代器相关概念

定义于命名空间 std::experimental::ranges

迭代器概念

指定类型通过应用运算符 * 可读
(概念)
指定可向迭代器所引用的对象写入值
(概念)
指定 Semiregular 类型能以前后自增运算符自增
(概念)
指定 WeaklyIncrementable 类型上的自增操作保持相等性,而且该类型 EqualityComparable
(概念)
指定该类型对象能自增并解引用
(概念)
指定类型的对象是 Iterator 类型的哨位
(概念)
指定能应用 - 运算符到迭代器和哨位,以在常数时间计算其差
(概念)
指定类型为输入迭代器,即能读其所引用值,且它能前后自增
(概念)
指定类型为给定值类型的输出迭代器,即能把该类型的值写入它,且它能前后自增
(概念)
指定 InputIterator 为向前迭代器,支持相等比较和多趟
(概念)
指定 ForwardIterator 为双向迭代器,支持向后移动
(概念)
指定 BidirectionalIterator 为随机访问迭代器,支持常数时间前进和下标访问
(概念)

间接可调用概念

指定可调用对象能以解引用一个 Readable 类型的结果调用
(概念)
指定可调用对象,以解引用某个 Readable 类型的结果调用时,满足 Predicate
(概念)
指定可调用对象以解引用某些 Readable 类型的结果调用时,满足 Relation
(概念)
指定可调用对象,以解引用某些 Readable 类型的结果调用时,满足 StrictWeakOrder
(概念)

常用算法要求

指定值可从 Readable 类型移动到 Writable 类型
(概念)
指定类型可从 Readable 类型移动到 Writable 类型,且移动可以通过中间对象进行
(概念)
指定值可从 Readable 类型复制到 Writable 类型
(概念)
指定值可从 Readable 类型复制到 Writable 类型,且该复制可能通过中间对象进行
(概念)
指定两个 Readable 类型所引用的值可交换
(概念)
指定两个 Readable 类型所引用的值能比较
(概念)
指定原位重排元素的算法的公共要求
(概念)
指定算法的要求,该算法需要通过复制元素归并已排序序列到输出序列
(概念)
指定重排元素为有序序列的算法的公共要求
(概念)

概念工具

计算在某 Readable 类型集合的解引用结果上调用可调用对象的结果
(类模板)
用于指定接受投影的算法上的制约的帮助模板
(类模板)

迭代器原语

迭代器工具

定义于命名空间 std::experimental::ranges
转型解引用对象的结果为其所关联的右值引用类型
(定制点对象)
交换两个可解引用对象所引用的值
(定制点对象)

迭代器特征

定义于命名空间 std::experimental::ranges
获得 WeaklyIncrementable 类型的差类型
(类模板)
获得 Readable 类型的值类型
(类模板)
获得输入迭代器类型的迭代器类别
(类模板)
汇集迭代器的关联类型的兼容性特性类
(别名模板)
获得可解引用对象的关联引用类型
(别名模板)

迭代器类别标签

定义于命名空间 std::experimental::ranges
用于指示迭代器类别的空类
(类)

std::iterator_traits 的特化

定义于命名空间 std
为范围 TS 迭代器特化 std::iterator_traits
(类模板特化)

迭代器操作

定义于命名空间 std::experimental::ranges
令迭代器前进给定的距离
(函数模板)
返回迭代器和哨位之间的距离,或范围起始和结尾间的距离
(函数模板)
自增迭代器
(函数模板)
自减迭代器
(函数模板)

迭代器适配器

定义于命名空间 std::experimental::ranges
用于逆序遍历的迭代器适配器
(类模板)
用于在容器尾插入的迭代器适配器
(类模板)
用于在容器首插入的迭代器适配器
(类模板)
用于插入元素到容器中的迭代器适配器
(类模板)
解引用为右值引用的迭代器适配器
(类模板)
move_iterator 所用的哨位适配器
(类模板)
将迭代器-哨位对适配成公共迭代器类型,以用于遗留算法
(类模板)
保持距起始位置距离踪迹的迭代器适配器
(类模板)
知晓其范围的迭代器类型所用的空哨位类型
(类)
可能悬垂的迭代器的包装器
(类模板)
dangling 包装右值范围的迭代器类型的别名模版
(别名模板)
用于与任何迭代器一同指示无限范围的哨位类型
(类)

流迭代器

定义于命名空间 std::experimental::ranges
std::basic_istream 读取的输入迭代器
(类模板)
写入 std::basic_ostream 的输出迭代器
(类模板)
std::basic_streambuf 读取的输入迭代器
(类模板)
写入 std::basic_streambuf 的输出迭代器
(类模板)

概要

namespace std { namespace experimental { namespace ranges { inline namespace v1 {
 
template <class T> concept bool /* dereferenceable */ // 仅用于阐释
  = requires(T& t) { {*t} -> auto&&; };
 
namespace {
  constexpr /* 未指明 */ iter_move = /* 未指明 */;
  constexpr /* 未指明 */ iter_swap = /* 未指明 */;
}
 
template <class> struct difference_type;
template <class T> using difference_type_t
  = typename difference_type<T>::type;
 
template <class> struct value_type;
template <class T> using value_type_t
  = typename value_type<T>::type;
 
template <class> struct iterator_category;
template <class T> using iterator_category_t
  = typename iterator_category<T>::type;
 
template </* dereferenceable */ T> using reference_t
  = decltype(*declval<T&>());
 
template </* dereferenceable */ T>
    requires /* 见定义 */ using rvalue_reference_t
  = decltype(ranges::iter_move(declval<T&>()));
 
template <class In>
concept bool Readable = /* 见定义 */;
 
template <class Out, class T>
concept bool Writable = /* 见定义 */;
 
template <class I>
concept bool WeaklyIncrementable = /* 见定义 */;
 
template <class I>
concept bool Incrementable = /* 见定义 */;
 
template <class I>
concept bool Iterator = /* 见定义 */;
 
template <class S, class I>
concept bool Sentinel = /* 见定义 */;
 
template <class S, class I>
  constexpr bool disable_sized_sentinel = false;
 
template <class S, class I>
concept bool SizedSentinel = /* 见定义 */;
 
template <class I>
concept bool InputIterator = /* 见定义 */;
 
template <class I>
concept bool OutputIterator = /* 见定义 */;
 
template <class I>
concept bool ForwardIterator = /* 见定义 */;
 
template <class I>
concept bool BidirectionalIterator = /* 见定义 */;
 
template <class I>
concept bool RandomAccessIterator = /* 见定义 */;
 
template <class F, class I>
concept bool IndirectUnaryInvocable = /* 见定义 */;
 
template <class F, class I>
concept bool IndirectRegularUnaryInvocable = /* 见定义 */;
 
template <class F, class I>
concept bool IndirectUnaryPredicate = /* 见定义 */;
 
template <class F, class I1, class I2 = I1>
concept bool IndirectRelation = /* 见定义 */;
 
template <class F, class I1, class I2 = I1>
concept bool IndirectStrictWeakOrder = /* 见定义 */;
 
template <class> struct indirect_result_of;
 
template <class F, class... Is>
  requires Invocable<F, reference_t<Is>...>
struct indirect_result_of<F(Is...)>;
 
template <class F>
using indirect_result_of_t
  = typename indirect_result_of<F>::type;
 
template <Readable I, IndirectRegularUnaryInvocable<I> Proj>
struct projected;
 
template <WeaklyIncrementable I, class Proj>
struct difference_type<projected<I, Proj>>;
 
template <class In, class Out>
concept bool IndirectlyMovable = /* 见定义 */;
 
template <class In, class Out>
concept bool IndirectlyMovableStorable = /* 见定义 */;
 
template <class In, class Out>
concept bool IndirectlyCopyable = /* 见定义 */;
 
template <class In, class Out>
concept bool IndirectlyCopyableStorable = /* 见定义 */;
 
template <class I1, class I2 = I1>
concept bool IndirectlySwappable = /* 见定义 */;
 
template <class I1, class I2, class R = equal_to<>, class P1 = identity,
    class P2 = identity>
concept bool IndirectlyComparable = /* 见定义 */;
 
template <class I>
concept bool Permutable = /* 见定义 */;
 
template <class I1, class I2, class Out,
    class R = less<>, class P1 = identity, class P2 = identity>
concept bool Mergeable = /* 见定义 */;
 
template <class I, class R = less<>, class P = identity>
concept bool Sortable = /* 见定义 */;
 
template <class Iterator> using iterator_traits = /* 见定义 */;
 
template <Readable T> using iter_common_reference_t
  = common_reference_t<reference_t<T>, value_type_t<T>&>;
 
struct output_iterator_tag { };
struct input_iterator_tag { };
struct forward_iterator_tag : input_iterator_tag { };
struct bidirectional_iterator_tag : forward_iterator_tag { };
struct random_access_iterator_tag : bidirectional_iterator_tag { };
 
namespace {
  constexpr /* 未指明 */ advance = /* 未指明 */;
  constexpr /* 未指明 */ distance = /* 未指明 */;
  constexpr /* 未指明 */ next = /* 未指明 */;
  constexpr /* 未指明 */ prev = /* 未指明 */;
}
 
template <BidirectionalIterator I> class reverse_iterator;
 
template <class I1, class I2>
    requires EqualityComparableWith<I1, I2>
  constexpr bool operator==(
    const reverse_iterator<I1>& x,
    const reverse_iterator<I2>& y);
template <class I1, class I2>
    requires EqualityComparableWith<I1, I2>
  constexpr bool operator!=(
    const reverse_iterator<I1>& x,
    const reverse_iterator<I2>& y);
template <class I1, class I2>
    requires StrictTotallyOrderedWith<I1, I2>
  constexpr bool operator<(
    const reverse_iterator<I1>& x,
    const reverse_iterator<I2>& y);
template <class I1, class I2>
    requires StrictTotallyOrderedWith<I1, I2>
  constexpr bool operator>(
    const reverse_iterator<I1>& x,
    const reverse_iterator<I2>& y);
template <class I1, class I2>
    requires StrictTotallyOrderedWith<I1, I2>
  constexpr bool operator>=(
    const reverse_iterator<I1>& x,
    const reverse_iterator<I2>& y);
template <class I1, class I2>
    requires StrictTotallyOrderedWith<I1, I2>
  constexpr bool operator<=(
    const reverse_iterator<I1>& x,
    const reverse_iterator<I2>& y);
 
template <class I1, class I2>
    requires SizedSentinel<I1, I2>
  constexpr difference_type_t<I2> operator-(
    const reverse_iterator<I1>& x,
    const reverse_iterator<I2>& y);
template <RandomAccessIterator I>
  constexpr reverse_iterator<I> operator+(
    difference_type_t<I> n,
    const reverse_iterator<I>& x);
 
template <BidirectionalIterator I>
constexpr reverse_iterator<I> make_reverse_iterator(I i);
 
template <class Container> class back_insert_iterator;
template <class Container>
  back_insert_iterator<Container> back_inserter(Container& x);
 
template <class Container> class front_insert_iterator;
template <class Container>
  front_insert_iterator<Container> front_inserter(Container& x);
 
template <class Container> class insert_iterator;
template <class Container>
  insert_iterator<Container> inserter(Container& x, iterator_t<Container> i);
 
template <InputIterator I> class move_iterator;
 
template <class I1, class I2>
    requires EqualityComparableWith<I1, I2>
  constexpr bool operator==(
    const move_iterator<I1>& x, const move_iterator<I2>& y);
template <class I1, class I2>
    requires EqualityComparableWith<I1, I2>
  constexpr bool operator!=(
    const move_iterator<I1>& x, const move_iterator<I2>& y);
template <class I1, class I2>
    requires StrictTotallyOrderedWith<I1, I2>
  constexpr bool operator<(
    const move_iterator<I1>& x, const move_iterator<I2>& y);
template <class I1, class I2>
    requires StrictTotallyOrderedWith<I1, I2>
  constexpr bool operator<=(
    const move_iterator<I1>& x, const move_iterator<I2>& y);
template <class I1, class I2>
    requires StrictTotallyOrderedWith<I1, I2>
  constexpr bool operator>(
    const move_iterator<I1>& x, const move_iterator<I2>& y);
template <class I1, class I2>
    requires StrictTotallyOrderedWith<I1, I2>
  constexpr bool operator>=(
    const move_iterator<I1>& x, const move_iterator<I2>& y);
 
template <class I1, class I2>
    requires SizedSentinel<I1, I2>
  constexpr difference_type_t<I2> operator-(
    const move_iterator<I1>& x,
    const move_iterator<I2>& y);
template <RandomAccessIterator I>
  constexpr move_iterator<I> operator+(
    difference_type_t<I> n,
    const move_iterator<I>& x);
 
template <InputIterator I>
  constexpr move_iterator<I> make_move_iterator(I i);
 
template <Semiregular S> class move_sentinel;
 
template <class I, Sentinel<I> S>
  constexpr bool operator==(
    const move_iterator<I>& i, const move_sentinel<S>& s);
template <class I, Sentinel<I> S>
  constexpr bool operator==(
    const move_sentinel<S>& s, const move_iterator<I>& i);
template <class I, Sentinel<I> S>
  constexpr bool operator!=(
    const move_iterator<I>& i, const move_sentinel<S>& s);
template <class I, Sentinel<I> S>
  constexpr bool operator!=(
    const move_sentinel<S>& s, const move_iterator<I>& i);
 
template <class I, SizedSentinel<I> S>
  constexpr difference_type_t<I> operator-(
    const move_sentinel<S>& s, const move_iterator<I>& i);
template <class I, SizedSentinel<I> S>
  constexpr difference_type_t<I> operator-(
    const move_iterator<I>& i, const move_sentinel<S>& s);
 
template <Semiregular S>
  constexpr move_sentinel<S> make_move_sentinel(S s);
 
template <Iterator I, Sentinel<I> S>
  requires !Same<I, S>
class common_iterator;
 
template <Readable I, class S>
struct value_type<common_iterator<I, S>>;
 
template <InputIterator I, class S>
struct iterator_category<common_iterator<I, S>>;
 
template <ForwardIterator I, class S>
struct iterator_category<common_iterator<I, S>>;
 
template <class I1, class I2, Sentinel<I2> S1, Sentinel<I1> S2>
bool operator==(
  const common_iterator<I1, S1>& x, const common_iterator<I2, S2>& y);
template <class I1, class I2, Sentinel<I2> S1, Sentinel<I1> S2>
  requires EqualityComparableWith<I1, I2>
bool operator==(
  const common_iterator<I1, S1>& x, const common_iterator<I2, S2>& y);
template <class I1, class I2, Sentinel<I2> S1, Sentinel<I1> S2>
bool operator!=(
  const common_iterator<I1, S1>& x, const common_iterator<I2, S2>& y);
 
template <class I2, SizedSentinel<I2> I1, SizedSentinel<I2> S1, SizedSentinel<I1> S2>
difference_type_t<I2> operator-(
  const common_iterator<I1, S1>& x, const common_iterator<I2, S2>& y);
 
class default_sentinel;
 
template <Iterator I> class counted_iterator;
 
template <class I1, class I2>
    requires Common<I1, I2>
  constexpr bool operator==(
    const counted_iterator<I1>& x, const counted_iterator<I2>& y);
constexpr bool operator==(
  const counted_iterator<auto>& x, default_sentinel);
constexpr bool operator==(
  default_sentinel, const counted_iterator<auto>& x);
template <class I1, class I2>
    requires Common<I1, I2>
  constexpr bool operator!=(
    const counted_iterator<I1>& x, const counted_iterator<I2>& y);
constexpr bool operator!=(
  const counted_iterator<auto>& x, default_sentinel y);
constexpr bool operator!=(
  default_sentinel x, const counted_iterator<auto>& y);
template <class I1, class I2>
    requires Common<I1, I2>
  constexpr bool operator<(
    const counted_iterator<I1>& x, const counted_iterator<I2>& y);
template <class I1, class I2>
    requires Common<I1, I2>
  constexpr bool operator<=(
    const counted_iterator<I1>& x, const counted_iterator<I2>& y);
template <class I1, class I2>
    requires Common<I1, I2>
  constexpr bool operator>(
    const counted_iterator<I1>& x, const counted_iterator<I2>& y);
template <class I1, class I2>
    requires Common<I1, I2>
  constexpr bool operator>=(
    const counted_iterator<I1>& x, const counted_iterator<I2>& y);
 
template <class I1, class I2>
    requires Common<I1, I2>
  constexpr difference_type_t<I2> operator-(
    const counted_iterator<I1>& x, const counted_iterator<I2>& y);
template <class I>
  constexpr difference_type_t<I> operator-(
    const counted_iterator<I>& x, default_sentinel y);
template <class I>
  constexpr difference_type_t<I> operator-(
    default_sentinel x, const counted_iterator<I>& y);
template <RandomAccessIterator I>
  constexpr counted_iterator<I>
    operator+(difference_type_t<I> n, const counted_iterator<I>& x);
 
template <Iterator I>
  constexpr counted_iterator<I> make_counted_iterator(I i, difference_type_t<I> n);
 
class unreachable;
template <Iterator I>
  constexpr bool operator==(const I&, unreachable) noexcept;
template <Iterator I>
  constexpr bool operator==(unreachable, const I&) noexcept;
template <Iterator I>
  constexpr bool operator!=(const I&, unreachable) noexcept;
template <Iterator I>
  constexpr bool operator!=(unreachable, const I&) noexcept;
 
template <class T> class dangling;
 
template <class T, class charT = char, class traits = char_traits<charT>,
    class Distance = ptrdiff_t>
  class istream_iterator;
 
template <class T, class charT, class traits, class Distance>
  bool operator==(const istream_iterator<T, charT, traits, Distance>& x,
    const istream_iterator<T, charT, traits, Distance>& y);
template <class T, class charT, class traits, class Distance>
  bool operator==(default_sentinel x,
    const istream_iterator<T, charT, traits, Distance>& y);
template <class T, class charT, class traits, class Distance>
  bool operator==(const istream_iterator<T, charT, traits, Distance>& x,
    default_sentinel y);
template <class T, class charT, class traits, class Distance>
  bool operator!=(const istream_iterator<T, charT, traits, Distance>& x,
    const istream_iterator<T, charT, traits, Distance>& y);
template <class T, class charT, class traits, class Distance>
  bool operator!=(default_sentinel x,
    const istream_iterator<T, charT, traits, Distance>& y);
template <class T, class charT, class traits, class Distance>
  bool operator!=(const istream_iterator<T, charT, traits, Distance>& x,
    default_sentinel y);
 
template <class T, class charT = char, class traits = char_traits<charT>>
  class ostream_iterator;
 
template <class charT, class traits = char_traits<charT> >
  class istreambuf_iterator;
 
template <class charT, class traits>
  bool operator==(const istreambuf_iterator<charT, traits>& a,
    const istreambuf_iterator<charT, traits>& b);
template <class charT, class traits>
  bool operator==(default_sentinel a,
    const istreambuf_iterator<charT, traits>& b);
template <class charT, class traits>
  bool operator==(const istreambuf_iterator<charT, traits>& a,
    default_sentinel b);
template <class charT, class traits>
  bool operator!=(const istreambuf_iterator<charT, traits>& a,
    const istreambuf_iterator<charT, traits>& b);
template <class charT, class traits>
  bool operator!=(default_sentinel a,
    const istreambuf_iterator<charT, traits>& b);
template <class charT, class traits>
  bool operator!=(const istreambuf_iterator<charT, traits>& a,
    default_sentinel b);
 
template <class charT, class traits = char_traits<charT> >
  class ostreambuf_iterator;
 
}}}}
 
namespace std {
  template <experimental::ranges::Iterator Out>
    struct iterator_traits<Out>;
  template <experimental::ranges::InputIterator In>
    struct iterator_traits<In>;
  template <experimental::ranges::InputIterator In>
      requires experimental::ranges::Sentinel<In, In>
    struct iterator_traits;
}
关闭