Are there any STL headers which are not part of the C++ Standard Library?

眉间皱痕 提交于 2019-11-29 02:14:39

问题


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.


回答1:


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.


来源:https://stackoverflow.com/questions/29218197/are-there-any-stl-headers-which-are-not-part-of-the-c-standard-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!