What's the difference between “STL” and “C++ Standard Library”?

前端 未结 7 791
忘了有多久
忘了有多久 2020-11-21 07:37

Someone brought this article to my attention that claims (I\'m paraphrasing) the STL term is misused to refer to the entire C++ Standard Library instead of the part

7条回答
  •  长发绾君心
    2020-11-21 07:45

    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. The term "C++ Standard Library" or "standard library" is what's officially used by ISO 14882:

    ISO 14882 C++ Standard:

    17 - Library introduction [lib.library]:

    1. This clauses describes the contents of the C++ Standard Library, how a well-formed C++ program makes use of the library, and how a conforming implementation may provide the entities in the library.

    ...

    STL is a library originally designed by Alexander Stepanov, independent of the C++ standard. However, some components of the C++ standard library include STL components like vector, list and algorithms like copy and swap.

    But of course the C++ standard includes much more things outside the STL, so the term "C++ standard library" is more correct (and is what's actually used by the standards documents).

提交回复
热议问题