ISO/IEC TS 21425:2017 编程语言 范围的c++扩展

标准编号:ISO/IEC TS 21425:2017

中文名称:编程语言 范围的c++扩展

英文名称:Programming languages — C++ Extensions for ranges

发布日期:2017-11

标准范围

ISO/IEC TS 21425:2017描述了C++编程语言(2)的扩展,允许对数据范围进行操作。这些扩展包括对现有图书馆设施的改变和增加,以及一个核心语言设施的扩展。特别是,对标准库的更改和扩展包括:-使用概念TS(2)的语法来制定基础和迭代器概念要求。-根据新概念指定的标准库算法的类似物。-放松算法约束以允许使用哨兵来表示范围的结束,并在必要时对算法返回类型进行相应的改变。-增加描述范围和视图抽象的新概念;也就是说,具有开始迭代器和结束哨兵的对象。-采用范围对象的新算法重载。-支持作为参数传递给算法的可调用对象(相对于函数对象)。-向算法添加可选投影参数以允许即时数据转换。-迭代器原语的类似物和新原语,以支持将哨兵添加到库中。-满足新迭代器概念的标准迭代器适配器和流迭代器的受约束模拟。-新的迭代器适配器(counted_iterator和common_iterator)和哨兵(不可达)。对核心语言的更改包括:-扩展基于范围的for语句,以支持新的迭代器范围要求(10.4)。ISO/IEC TS 21425:2017没有规定标准库其他部分的受约束类似物(例如。例如,数值算法),它也没有向所有可以从中受益的地方(例如,容器)添加范围支持。ISO/IEC TS 21425:2017没有指定任何新的范围视图、操作或立面或适配器实用程序;所有这些都留给未来的工作。

ISO/IEC TS 21425:2017 describes extensions to the C++ Programming Language (2) that permit operations on ranges of data. These extensions include changes and additions to the existing library facilities as well as the extension of one core language facility. In particular, changes and extensions to the Standard Library include:
- The formulation of the foundational and iterator concept requirements using the syntax of the Concepts TS (2).
- Analogues of the Standard Library algorithms specified in terms of the new concepts.
- The loosening of the algorithm constraints to permit the use of sentinels to denote the end of a range and corresponding changes to algorithm return types where necessary.
- The addition of new concepts describing range and view abstractions; that is, objects with a begin iterator and an end sentinel.
- New algorithm overloads that take range objects.
- Support of callable objects (as opposed to function objects) passed as arguments to the algorithms.
- The addition of optional projection arguments to the algorithms to permit on-the-fly data transformations.
- Analogues of the iterator primitives and new primitives in support of the addition of sentinels to the library.
- Constrained analogues of the standard iterator adaptors and stream iterators that satisfy the new iterator concepts.
- New iterator adaptors (counted_iterator and common_iterator) and sentinels (unreachable).
Changes to the core language include:
- the extension of the range-based for statement to support the new iterator range requirements (10.4).
ISO/IEC TS 21425:2017 does not specify constrained analogues of other parts of the Standard Library (e.g., the numeric algorithms), nor does it add range support to all the places that could benefit from it (e.g., the containers).
ISO/IEC TS 21425:2017 does not specify any new range views, actions, or facade or adaptor utilities; all are left as future work.

标准预览图


立即下载标准文件