6 ms·
I'm not well-versed in C++, so I'm a bit confused about the difference between the C++ Standard Library and the Standard Template Library (STL). Wikipedia tells
by md224 7y ago
I'm not well-versed in C++, so I'm a bit confused about the difference between the C++ Standard Library and the Standard Template Library (STL). Wikipedia tells me that they're related but technically separate things, yet this GitHub page says:
> This is the official repository for Microsoft's implementation of the C++ Standard Library (also known as the STL)
and appears to use the two terms interchangeably. Is this the C++ Standard Library or the STL?
- pnako 7y agoIt's the standard library. People sometimes say STL to refer to the entire standard library because the names are similar and because the STL is a huge chunk of the standard library (and the non-STL parts of the standard library also tend to use templates anyway, to add to the whole confusion...) But if you look at the repo you see the C headers like cmath, etc. that have nothing to do with the STL and are just part of the standard library.
- nikbackm 7y agoNote that the C library (CRT) is not included here though, as that's now delivered with Windows itself as the Universal CRT. The cmath header here just forwards to math.h and has no real content of its own.
- pnako 7y agoAh. Maybe we'll get it when they open source the rest of the toolchain :D
- percentcer 7y agohttps://stackoverflow.com/questions/5205491/whats-the-difference-between-stl-and-c-standard-library https://stackoverflow.com/questions/5205491/whats-the-differ... this is a pretty solid answer to your question
- md224 7y agoDuh, I knew I should've googled first. That definitely clears it up, thanks!
- option_greek 7y agoStandard library of Cpp uses templates extensively. So both terms are used interchangeably.
- cgrealy 7y agoBut incorrectly. I really wish MS hadn't called the repo stl, it just adds to the confusion.
- StephanTLavavej 7y agoIt’s what we’ve been calling our code for a long time (in VCBlog articles, etc.) and it’s a perfectly valid use of metonymy: https://en.wikipedia.org/wiki/Metonymy https://en.wikipedia.org/wiki/Metonymy Scott Meyers wrote a book called “Effective STL”, and there’s a somewhat-similar-interface library named https://github.com/electronicarts/EASTL https://github.com/electronicarts/EASTL - neither of these lead to confusion.
- garmaine 7y agoI know I'm replying to the "STL" with vastly more domain experience here than me, but isn't it true that Scott Meyers' book covers just the STL, as originally defined? The only thing outside of the STL as shown in the table of contents is some lessons on std::string, but even that is in context / comparison with vector, an STL container type. I'm sorry, but effective communication is valuable and it is annoying that your employer continues to conflate the C++ standard library and the STL. Are we going to start referring to the standard library as "boost" a few years hence? That's basically the situation we've ended up in here.
- StephanTLavavej 7y agoI used to use “the STL” to refer to “the part of the C++ Standard Library strongly influenced by the design of the historical library”, excluding iostreams etc. Later, I decided this didn’t really achieve anything. It’s a Standard Library that’s full of Templates! There are other design philosophies in there, but they are increasingly unimportant. Having to say “C++ Standard Library” all the time, or trying to popularize a new acronym, are worse alternatives. Yes, effective communication is valuable. I have been working on this library for over a decade and I find that the short, memorable acronym ultimately makes it easier to talk about the thing. That said, we are primarily using the acronym for the repo URL and the directory structure; the readme makes it clear that this is “also known as” the STL.
- jonesetc 7y agoThere was a library called the STL that is now, with modifications, a part of the std library. So in a sense you could say that the STL is a subset of the std library, or that it was an inspiration for part of it, but many people just use the terms interchangeably. So, what that read me says is correct, it is also called the STL. If you want to be precise you should probably only call it the std library though. There are still implementations of the original STL around separate from the std library, so keeping the distinction is probably still wise. Also to complicate things, some people use the term STL to refer to the specific parts of the std library that are from the original STL. Those pieces are containers, algorithms, functions, and iterators I think. tl;dr it's all a mess and people say the two meaning different things all the time.
- StephanTLavavej 7y ago> There are still implementations of the original STL around separate from the std library, so keeping the distinction is probably still wise. As far as I am aware, those libraries are defunct and unused (e.g. STLPort), so I disagree that there is an important distinction to preserve. The most widely used C++ Standard Library implementations by far are GCC’s libstdc++, Clang/LLVM’s libc++, and MSVC’s STL. Being bundled with compilers means that there is no reason to want an implementation of the historical ancestor library.
- kragen 7y agoIntellectually, the STL represents a significant set of innovations and a new way of designing reusable software, and it is an elegant jewel of design; the C++ standard library does not share those distinctions. If someone is having trouble with a software design problem in another programming language, it might be a useful suggestion to tell them to try doing it “the STL way,” but telling them to do it the “standard library way” would mean something quite different. There's also the issue of credit. The STL is a work by Alexander Stepanov and Meng Lee. Conflating it with the C++ standard library of which it has become a part—or, worse, with a particular company's implementation thereof—has the distasteful flavor of plagiarism.
- deleted 7y ago[deleted]