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

  • Mastering C++ Programming
  • Jeganathan Swaminathan
  • 217字
  • 2021-07-02 18:28:48

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.

主站蜘蛛池模板: 湖州市| 博湖县| 珠海市| 霍林郭勒市| 昭通市| 汉沽区| 霍山县| 县级市| 阳城县| 香河县| 光泽县| 饶平县| 南溪县| 永仁县| 余姚市| 江阴市| 七台河市| 昌乐县| 博白县| 晴隆县| 天峨县| 龙泉市| 道真| 麻栗坡县| 万荣县| 广西| 陆川县| 甘南县| 井陉县| 犍为县| 崇礼县| 景泰县| 商丘市| 伊金霍洛旗| 石首市| 拉孜县| 深泽县| 左权县| 神农架林区| 蓬安县| 墨脱县|