gpt4 book ai didi

c++ - 哪个 C++ 规范开始支持 std::vector

转载 作者:行者123 更新时间:2023-12-01 13:51:13 32 4
gpt4 key购买 nike

我想知道哪个 C++ 规范开始支持 std::vector?此外,我们如何(通过预处理器宏)检查 C++ 编译器是否支持此规范?

最佳答案

在 C++98 中引入,至少自 WG21/N0545 1994 年 9 月以来是工作草案的一部分
Chapter 23 , [lib.containers], 的

  • WG21/N0545: Working Paper for Draft Proposed International Standard for Information Systems-- Programming Language C++

  • 1994 年 9 月 20 日的论文(非正式 September 1994 C++ Working Paper),特别是 [lib.vector]部分是,afaik,第一个正式的论文/草稿介绍( std::) vector ,以及许多其他熟悉的容器类。
    每年更新的 C++ 工作论文最终成为第一个 C++ ISO 标准版本, ISO/IEC 14882:1998 - Programming languages — C++ ,其中包括 STL 及其初始容器类集。
    第一次提及:1991 年 11 月在达拉斯的 session
    由于在 1998 年第一个 ISO 版本之前,关于该语言的一切都可以被认为处于草案/演进阶段,因此容器可能更早被讨论和提出。上面的章节可能已经以某种形式出现在 WG21/N0100(美国国家信息系统标准草案的工作文件 - 1992 年的编程语言)中,但我找不到该引用的拷贝。 WG21/N0110 1992 年 3 月 3 日图书馆工作组的报告确实提到了容器部分,并且在 1991 年已经开始/考虑了与它相关的工作 [ 重点 矿]:

    Progress Report - November 1991 - March 1992

    [...]

    What is the group working on

    While the language portion of C++ has had over 10 years' evolution and refinement, the standard library has had much less time to develop. The availability of templates and exceptions, only recently added to the language, has a significant impact on the design of libraries for C++. [...]

    Current focus

    The current focus of the Library group remains as it has since the July, 1990 meeting in Seattle. The November, 1991 meeting in Dallas added consideration of simple container classes.

    [...]

    18.5 Containers

    Reviewing available libraries revealed a small set of common classes. Strings were most frequent, and are already in the C++ library (18.4). Array and bit set classes were next most frequent, and appeared "easy" to specify.

    The design approach would emphasize Concrete Data Types using templates. Proposals for container classes will add a new section to the library portion of the standard.

    [...]

    Open issues from last time

    [...]

    18.5 Containers

    [...] agreed to allow the Library working group to pursue specification of two new components. [...]

    The BitSet component [...]. The Array component will described self-describing arrays that avoid some of the problems associated with the array derived type define in the language.

    [...]


    这首先引用了“The Array [STL container] component”的工作,后来(分支到)了 DynArray组件(见下文)最终成为 std::vector .
    WG21/N0083:C++ 中的通用动态数组
    论文
  • WG21/N0083: Generic Dynamic Arrays

  • 来自 1992 年 1 月 4 日的提案是 通用动态数组类 命名 DynArray , 另一个名称提案为 vector :

    Generic Dynamic Arrays in C++

    [...]

    2. Proposal for a generic dynamic array class

    [...] The name "DynArray" for this class is selected as "array" is a built-in type in C++ and the alternative "vector" may be expected to be a mathematical class (and would have different member functions). [...]

    关于c++ - 哪个 C++ 规范开始支持 std::vector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62573919/

    32 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com