Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 254
Marc.2377 Avatar asked Mar 23 '15 18:03

Marc.2377


People also ask

Is STL part of standard library?

In layman words: STL is part of Standard Library.

How STL is different from the C++ Standard Library?

Note that the term "STL" or "Standard Template Library" does not show up anywhere in the ISO 14882 C++ standard. So referring to the C++ standard library as STL is wrong, ie, STL and C++ Standard Library are 2 different things with the former being the subset of the latter.

Is the C++ Standard Library header only?

Note the part of the C++ Standard Library which makes use of templates such as <vector> , string> , <map> , etc is header-only library. Actually templates (class templates and function templates) cannot be compiled into static or dynamic library to be linked to programs.


1 Answers

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.
like image 178
OmnipotentEntity Avatar answered Oct 18 '22 22:10

OmnipotentEntity