是否有不属于C ++标准库的STL标头? [英] Are there any STL headers which are not part of the C++ Standard Library?

查看:69
本文介绍了是否有不属于C ++标准库的STL标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道某些C ++标准库标头来自STL,例如 vector 。但是我找不到标准库仍未包含的STL标头的最新列表。它们存在吗?



PS:我想将它们列出,并想知道是否所有主要的实现都包括它们,或者在可能的情况下从哪里获得。

p>

解决方案

注意,这是按功能分解的函数,而不是按标头分解的函数,因为它似乎更有用。 / p>

如果我们查看 SGI的文档STL 我们发现以下内容:


  1. slist 已重命名 std :: forward_list

  2. bit_vector 已被替换为模板规范 std :: vector< bool> 。这样的实现可以(不是必须)以 bit_vector 的方式优化空间。

  3. hash_set 和朋友现在的拼写类似于 unordered_set 。功能似乎是相同的。 (感谢T.C。!)
  4. 缺少
  5. 绳索。标准库中没有等效的数据结构。我找不到与此主题相关的WG21讨论。

  6. sequence_buffer 丢失了,因为这主要是用于向后插入绳子

  7. random_sample random_sample_n 丢失。原因在N3547中进行了讨论:


    在WG21在Sophia-Antipolis会议上进行审议之后,Austern更新了该提案。
    在其他更改中,他撤回了[ random_sample random_sample_n ]: LWG担心他们可能对于标准化还不够了解。 。 。 。建议
    用于TR2的算法是适当的 [
    Aus08b
    ]。讨论的Wiki分钟同样简短: Bjarne
    感到理由不足。 PJ担心我们会弄错。劳伦斯担心,人们会自己动手弄错。 TR2的好候选人 [
    LWG08
    ]。随后对这些拟议算法的
    投票获得了可靠的LWG共识(10-1,2 abs。),赞成将其将来的
    纳入技术报告(现称为技术规范)



random_sample_n 算法的一个版本已提交到图书馆基础知识TS,并称为 std :: experimental :: sample ,提案N3925的最新版本已于2014-02年采用,但仍未包括在内标准,我想我们会在C ++ 17中看到。 (感谢T.C。!)


  1. lexicographical_compare_3way 丢失。根据N2666,它被认为不够重要。

  2. power 的拼写是 pow ,并且没有 power 具备的一般功能。

  3. 身份 project1st project2nd select1st select2nd 从未实现标准化。我找不到关于原因的讨论。

  4. subtractive_rng 也丢失了。推测是因为< random> 将取代此问题空间。

  5. binder1st binder2nd ptr_fun pointer_to_unary_function pointer_to_binary_function mem_fun (和朋友), unary_compose binary_compose 丢失或不建议使用。他们或多或少地被 std :: bind 和朋友所取代。

  6. 构造 destroy 已被移至 allocator 类,并且不作为独立函数存在。 (感谢T.C。!)

  7. temporary_buffer 丢失。但是 get_temporary_buffer return_temporary_buffer 可用。我还无法确切找到原因,但是我遇到的chat不休似乎暗示它在某种程度上从根本上被打破了,许多人一直在尝试对其进行修复。到底是什么以及如何成为我的谜。


I know that some C++ Standard Library headers are originated from the STL, such as vector. But I'm failing to find an up-do-date list of STL headers which are still not incorporated by the Standard Library. Do they exist?

PS: I would like to have them listed, and also to know if all major implementations include them or where to get them, if possible.

解决方案

Note, this is a function by function break down, rather than a by header breakdown, because it seems to be more useful.

If we examine SGI's documentation of the STL we find the following:

  1. slist has been renamed std::forward_list.
  2. bit_vector has been replaced by a template specification of std::vector<bool>. The implementation of this may (not must) optimize for space in the way that bit_vector does.
  3. hash_set and friends are now spelled like unordered_set. Functionality seems to be the same. (Thanks T.C.!)
  4. rope is missing. There is no equivalent data structure in the standard library. I could not find a relevant WG21 discussion on the topic.
  5. sequence_buffer is missing, because this was primarily used for back inserting a rope.
  6. random_sample and random_sample_n are missing. The reason is discussed in N3547:

    After WG21 consideration at the Sophia-Antipolis meeting, Austern updated the proposal. Among other changes, he withdrew [random_sample and random_sample_n]: "The LWG was concerned that they might not be well enough understood for standardization. . . . It may be appropriate to propose those algorithms for TR2" [ Aus08b ]. The wiki minutes of the discussion are equally terse: "Bjarne feels rationale is insufficient. PJ worries we will get it wrong. Lawrence worries that people will roll their own and get it wrong. Good candidate for TR2" [ LWG08 ]. The subsequent vote regarding these proposed algorithms achieved a solid LWG consensus (10-1, 2 abs.) in favor of their future inclusion in a Technical Report (now termed a Technical Specification)

A version of the random_sample_n algorithm has made it to the Library Fundamentals TS and is called std::experimental::sample, the latest iteration of the proposal N3925 was adopted in 2014-02 but remains not yet part of the standard, I suppose we'll see in in C++17. (Thanks T.C.!)

  1. lexicographical_compare_3way is missing. It was seen as "not important enough" to standardize according to N2666.
  2. power is spelled pow and does not have the generalized capabilities that power does.
  3. identity, project1st, project2nd, select1st and select2nd never made it to standardization. I could not find a discussion regarding why.
  4. subtractive_rng is missing as well. Presumptively because <random> would be superseding this problem space.
  5. binder1st, binder2nd, ptr_fun, pointer_to_unary_function, pointer_to_binary_function, mem_fun (and friends), unary_compose, and binary_compose are missing or deprecated. They are more or less superseded by std::bind and friends.
  6. construct and destroy have been moved into the allocator class and do not exist as standalone functions. (Thanks T.C.!)
  7. temporary_buffer is missing. But get_temporary_buffer and return_temporary_buffer are available. I haven't been able to find out exactly why, but what chatter I have ran across seems to imply that it's broken in some way pretty fundamentally, and lots of people have been trying to fix it. Exactly what and how remains a mystery to me.

这篇关于是否有不属于C ++标准库的STL标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆