问题
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:
slisthas been renamedstd::forward_list.bit_vectorhas been replaced by a template specification ofstd::vector<bool>. The implementation of this may (not must) optimize for space in the way thatbit_vectordoes.hash_setand friends are now spelled likeunordered_set. Functionality seems to be the same. (Thanks T.C.!)ropeis missing. There is no equivalent data structure in the standard library. I could not find a relevant WG21 discussion on the topic.sequence_bufferis missing, because this was primarily used for back inserting arope.random_sampleandrandom_sample_nare 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_sampleandrandom_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.!)
lexicographical_compare_3wayis missing. It was seen as "not important enough" to standardize according to N2666.poweris spelledpowand does not have the generalized capabilities thatpowerdoes.identity,project1st,project2nd,select1standselect2ndnever made it to standardization. I could not find a discussion regarding why.subtractive_rngis missing as well. Presumptively because<random>would be superseding this problem space.binder1st,binder2nd,ptr_fun,pointer_to_unary_function,pointer_to_binary_function,mem_fun(and friends),unary_compose, andbinary_composeare missing or deprecated. They are more or less superseded bystd::bindand friends.constructanddestroyhave been moved into theallocatorclass and do not exist as standalone functions. (Thanks T.C.!)temporary_bufferis missing. Butget_temporary_bufferandreturn_temporary_bufferare 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