From the course: C++ Standard Template Library

Why we need the STL - C++ Tutorial

From the course: C++ Standard Template Library

Start my 1-month free trial

Why we need the STL

- [Instructor] Let's explore why we need the C++ Standard Template Library. There are many good reasons to use this library, and there's also some inevitable criticism. So let me tell you the most important reasons why I think you should integrate the STL in your programming knowledge. The STL enables us to create code quickly, efficiently, coherently, and generically. Let me tell you what I mean. You'll create code quickly because the STL is, well, a library, so chances are the data structure and algorithm you want to perform are at least basically already implemented and available to you. You'll create efficient code simply because this library has been out there since the 1980s, implemented for a handful of compiler toolchains, and it has been constantly maintained by its implementation developers so that it produces the most efficient output possible. You'll create code that is coherent with the code written by other programmers in your team. It is often understood that a C++ programmer knows not just the programming language, but also most of the many libraries that are included in its implementations. In fact, the Standard Template Library is so frequently available in C++ compiler toolchains and IDs, that it's common to refer to the STL and the C++ standard library interchangeably. This is sometimes a touchy topic, so be advised that the STL and the C++ standard library are formally two different things. Now here's what I think is the most important reason to use the C++ STL. You'll create generic code. By generic, I mean that you're required to specify your data types at instantiation, because libraries are written as templates. This flexibility allows the programmer to concentrate on the data structure's behavior, regardless of its content. We'll cover more about this in the course.

Contents