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

前端 未结 7 780
忘了有多久
忘了有多久 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条回答
  •  -上瘾入骨i
    2020-11-21 07:48

    From the GNU Standard C++ Library (libstdc++) FAQ:


    The STL (Standard Template Library) was the inspiration for large chunks of the C++ Standard Library, but the terms are not interchangeable and they don't mean the same thing. The C++ Standard Library includes lots of things that didn't come from the STL, and some of them aren't even templates, such as std::locale and std::thread.

    Libstdc++-v3 incorporates a lot of code from the SGI STL (the final merge was from release 3.3). The code in libstdc++ contains many fixes and changes compared to the original SGI code.

    In particular, string is not from SGI and makes no use of their "rope" class (although that is included as an optional extension), neither is valarray nor some others. Classes like vector<> were from SGI, but have been extensively modified.

    More information on the evolution of libstdc++ can be found at the API evolution and backwards compatibility documentation.

    The FAQ for SGI's STL is still recommended reading.


    FYI, as of March 2018 even the official STL web site www.sgi.com/tech/stl/ is gone.

提交回复
热议问题