实验库头文件 <experimental/ranges/iterator>
来自 cppreference.com
< cpp | header | experimental
该头文件是 范围 库的一部分。
内容 |
[edit]
在命名空间
std::experimental::ranges 中定义 |
[edit] 迭代器概念
指定类型可以通过应用运算符 * 来读取。(概念) | |
指定可以将值写入迭代器引用的对象。 (概念) | |
指定一个 Semiregular 类型可以使用前增量和后增量运算符进行增量。(概念) | |
指定一个 WeaklyIncrementable 类型的增量操作是等式保持的,并且该类型是 EqualityComparable 。(概念) | |
指定一个类型对象可以被增量和解引用。 (概念) | |
指定一个类型的对象是 Iterator 类型的哨兵。(概念) | |
指定 - 运算符可以应用于迭代器和哨兵,以计算它们在恒定时间内的差异。(概念) | |
指定一个类型是输入迭代器,即它的引用值可以被读取,并且它可以被前增量和后增量。 (概念) | |
指定一个类型是给定值类型的输出迭代器,即该类型的值可以被写入,并且它可以被前增量和后增量。 (概念) | |
指定一个 InputIterator 是一个前向迭代器,支持相等比较和多遍。(概念) | |
指定一个 ForwardIterator 是一个双向迭代器,支持向后移动。(概念) | |
指定一个 BidirectionalIterator 是一个随机访问迭代器,支持在恒定时间内前进和下标。(概念) |
[edit] 间接可调用概念
指定一个可调用类型可以使用 Readable 类型解引用的结果进行调用。(概念) | |
指定一个可调用对象,当它使用 Readable 类型解引用的结果进行调用时,满足 Predicate 。(概念) | |
指定一个可调用对象,当它使用一些 Readable 类型解引用的结果进行调用时,满足 Relation 。(概念) | |
指定一个可调用对象,当它使用一些 Readable 类型解引用的结果进行调用时,满足 StrictWeakOrder 。(概念) |
[edit] 通用算法需求
指定可以从 Readable 类型移动到 Writable 类型的值。(概念) | |
指定可以从 Readable 类型移动到 Writable 类型的值,并且可以通过中间对象执行移动。(概念) | |
指定可以从 Readable 类型复制到 Writable 类型的值。(概念) | |
指定可以从 Readable 类型复制到 Writable 类型的值,并且可以通过中间对象执行复制。(概念) | |
指定两个 Readable 类型引用的值可以被交换。(概念) | |
指定两个 Readable 类型引用的值可以被比较。(概念) | |
指定就地重新排列元素的算法的通用要求 (概念) | |
指定通过复制元素将排序后的序列合并到输出序列中的算法的要求 (概念) | |
指定将序列排列成排序序列的算法的通用要求 (概念) |
[edit] 概念实用程序
计算在对一些Readable 类型进行解引用之后的结果上调用可调用对象的结果(类模板) | |
用于指定接受投影的算法的约束的辅助模板 (类模板) |
[edit] 迭代器原语
[edit] 迭代器实用程序
在命名空间
std::experimental::ranges 中定义 | |
将对象的解引用结果转换为其关联的右值引用类型 (定制点对象) | |
交换两个可解引用的对象引用的值 (定制点对象) |
[edit] 迭代器特征
在命名空间
std::experimental::ranges 中定义 | |
获取WeaklyIncrementable 类型的差值类型(类模板) | |
获取Readable 类型的值类型(类模板) | |
获取输入迭代器类型的迭代器类别 (类模板) | |
收集迭代器关联类型的兼容性特征类 (别名模板) | |
获取可解引用对象的关联引用类型 (别名模板) |
[edit] 迭代器类别标签
在命名空间
std::experimental::ranges 中定义 | |
用于指示迭代器类别的空类类型 (类) |
[edit] std::iterator_traits 特化
在命名空间
std 中定义 | |
为范围 TS 迭代器特化 std::iterator_traits (类模板特化) |
[edit] 迭代器操作
在命名空间
std::experimental::ranges 中定义 | |
将迭代器向前移动给定的距离 (函数模板) | |
返回迭代器和哨兵之间的距离,或者返回范围的开始和结束之间的距离 (函数模板) | |
递增迭代器 (函数模板) | |
递减迭代器 (函数模板) |
[edit] 迭代器适配器
在命名空间
std::experimental::ranges 中定义 | |
用于反向遍历的迭代器适配器 (类模板) | |
用于在容器末尾插入的迭代器适配器 (类模板) | |
用于在容器开头插入的迭代器适配器 (类模板) | |
用于将元素插入容器的迭代器适配器 (类模板) | |
解引用到右值引用的迭代器适配器 (类模板) | |
与 move_iterator 一起使用的哨兵适配器(类模板) | |
将迭代器-哨兵对适配到一个通用迭代器类型,以便与传统算法一起使用 (类模板) | |
跟踪其距起始位置的距离的迭代器适配器 (类模板) | |
空哨兵类型,用于与知道其范围边界的迭代器类型一起使用 (类) | |
可能悬空迭代器的包装器 (类模板) | |
将右值范围的迭代器类型用 dangling 包装的别名模板(别名模板) | |
与任何迭代器一起使用的哨兵类型,用于表示无限范围 (类) |
[edit] 流迭代器
在命名空间
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 */ // exposition only = requires(T& t) { {*t} -> auto&&; }; namespace { constexpr /* unspecified */ iter_move = /* unspecified */; constexpr /* unspecified */ iter_swap = /* unspecified */; } 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 /* see definition */ using rvalue_reference_t = decltype(ranges::iter_move(declval<T&>())); template <class In> concept bool Readable = /* see definition */; template <class Out, class T> concept bool Writable = /* see definition */; template <class I> concept bool WeaklyIncrementable = /* see definition */; template <class I> concept bool Incrementable = /* see definition */; template <class I> concept bool Iterator = /* see definition */; template <class S, class I> concept bool Sentinel = /* see definition */; template <class S, class I> constexpr bool disable_sized_sentinel = false; template <class S, class I> concept bool SizedSentinel = /* see definition */; template <class I> concept bool InputIterator = /* see definition */; template <class I> concept bool OutputIterator = /* see definition */; template <class I> concept bool ForwardIterator = /* see definition */; template <class I> concept bool BidirectionalIterator = /* see definition */; template <class I> concept bool RandomAccessIterator = /* see definition */; template <class F, class I> concept bool IndirectUnaryInvocable = /* see definition */; template <class F, class I> concept bool IndirectRegularUnaryInvocable = /* see definition */; template <class F, class I> concept bool IndirectUnaryPredicate = /* see definition */; template <class F, class I1, class I2 = I1> concept bool IndirectRelation = /* see definition */; template <class F, class I1, class I2 = I1> concept bool IndirectStrictWeakOrder = /* see definition */; 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 = /* see definition */; template <class In, class Out> concept bool IndirectlyMovableStorable = /* see definition */; template <class In, class Out> concept bool IndirectlyCopyable = /* see definition */; template <class In, class Out> concept bool IndirectlyCopyableStorable = /* see definition */; template <class I1, class I2 = I1> concept bool IndirectlySwappable = /* see definition */; template <class I1, class I2, class R = equal_to<>, class P1 = identity, class P2 = identity> concept bool IndirectlyComparable = /* see definition */; template <class I> concept bool Permutable = /* see definition */; template <class I1, class I2, class Out, class R = less<>, class P1 = identity, class P2 = identity> concept bool Mergeable = /* see definition */; template <class I, class R = less<>, class P = identity> concept bool Sortable = /* see definition */; template <class Iterator> using iterator_traits = /* see definition */; 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 /* unspecified */ advance = /* unspecified */; constexpr /* unspecified */ distance = /* unspecified */; constexpr /* unspecified */ next = /* unspecified */; constexpr /* unspecified */ prev = /* unspecified */; } 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; }