官术网_书友最值得收藏!

The Standard Template Library architecture

The C++ Standard Template Library (STL) offers ready-made generic containers, algorithms that can be applied to the containers, and iterators to navigate the containers. The STL is implemented with C++ templates, and templates allow generic programming in C++.

The STL encourages a C++ developer to focus on the task at hand by freeing up the developer from writing low-level data structures and algorithms. The STL is a time-tested library that allows rapid application development.  

The STL is an interesting piece of work and architecture. Its secret formula is compile-time polymorphism. To get better performance, the STL avoids dynamic polymorphism, saying goodbye to virtual functions. Broadly, the STL has the following four components:

  • Algorithms
  • Functors
  • Iterators
  • Containers

The STL architecture stitches all the aforementioned four components together. It has many commonly used algorithms with performance guarantees. The interesting part about STL algorithms is that they work seamlessly without any knowledge about the containers that hold the data. This is made possible due to the iterators that offer high-level traversal APIs, which completely abstracts the underlying data structure used within a container. The STL makes use of operator overloading quite extensively. Let's understand the major components of STL one by one to get a good grasp of the STL conceptually.

主站蜘蛛池模板: 波密县| 西宁市| 莱州市| 西畴县| 临朐县| 尚义县| 马边| 承德市| 江口县| 西畴县| 南郑县| 台中县| 洛扎县| 沁源县| 湖北省| 阳城县| 五常市| 霍山县| 龙口市| 勃利县| 南丹县| 钟山县| 百色市| 志丹县| 台东市| 阿尔山市| 陆川县| 昭通市| 福贡县| 巴塘县| 开阳县| 榆中县| 祁东县| 响水县| 桃园市| 潞西市| 凤山县| 峨山| 大邑县| 通山县| 启东市|