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

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.

主站蜘蛛池模板: 南城县| 河东区| 温宿县| 无为县| 雅安市| 利川市| 毕节市| 丰城市| 伊川县| 郯城县| 泰兴市| 武安市| 黄浦区| 永吉县| 延庆县| 昌宁县| 上高县| 格尔木市| 冷水江市| 舒兰市| 璧山县| 东辽县| 陵川县| 游戏| 仁化县| 彭阳县| 苏尼特左旗| 天津市| 那坡县| 环江| 福清市| 信丰县| 遂宁市| 贺兰县| 疏勒县| 房产| 积石山| 蒙山县| 彭水| 乐东| 丽江市|