C ++ STL initial introduction 01

STL provides six components, may be combined with each other to apply, which are six major components:
a container, algorithms, iterators, functor adapter, space configurator

Briefly:
container: various data structures, into a vector, list, deque, set, map , etc., used to store data, from the implementation point of view, the STL container is a class template.
Algorithm: various commonly used algorithms, such as . sort, find, copy, for_each from an implementation perspective, stl algorithm is a function template.
iterators: playing the glue between the container and algorithms, a total of five types, from the implementation point of view, the iterator will be an operator *, operator->, operator ++ , operator- and other related operations overloaded pointer class template, all the STL containers are shipped with its own dedicated iterator, only the container designers know how to traverse its element, but also a pointer to the native iterator.
functor: similar behavior function, the algorithm can be used as a strategy, from the implementation point of view, is a functor overloaded operator () of class or class Template.
adapter: It used to modify a special container or something functor iterator interface or the
spatial configuration is: responsible for configuration and management of the space, from the implementation point of view, is a real configuration Now the dynamic space allocation, space management, space freed class template

Interactions STL 6 large components: a container made of data storage space by space allocation, algorithms, iterators through the contents of the storage container, functor algorithm can help complete different strategy changes, the adapter can be modified copy function.

发布了100 篇原创文章 · 获赞 6 · 访问量 1万+

Guess you like

Origin blog.csdn.net/weixin_43903378/article/details/104074474