其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
STL 之 Introducntion

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

STL, is a C++ library of container classes, algorithms, and iterators;  almost every component in the STL is a template. 

Containers and algorithms

The STL includes the classes vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap. algorithm is a global function, not a member function , it operates on a range of elements, rather than on a container. In this particular case the range happens to be the entire container .  algorithm  is decoupled from the STL container classes

Iterators

Pointers themselves are iterators, which is why it is possible to reverse the elements of a C array. Iterators are the mechanism that makes it possible to decouple algorithms from containers: algorithms are templates, and are parameterized by the type of iterator, so they are not restricted to a single type of container.

Concepts and Modeling

the arguments of algorithm's function implicitly defines a set of requirements on types, and that it may be instantiated with any type that satisfies those requirements. we call such a set of type requirements a concept ! We say that a type conforms to a concept, or that it is a model of a concept . programming in terms of concepts, rather than in terms of specific types, makes it possible to reuse software components and to combine components together.

Refinement

Refinement of concepts is very much like inheritance of C++ classes; the main reason we use a different word, instead of just calling it "inheritance", is to emphasize that refinement applies to concepts rather than to actual types.

Other parts of the STL

First, Assignable describes types that have assignment operators and copy constructors; almost all STL classes are models of Assignable, and almost all STL algorithms require their arguments to be models of Assignable .
Second, the STL includes some low-level mechanisms for allocating and deallocating memory. Allocators are very specialized, and you can safely ignore them for almost all purposes.
Finally, the STL includes a large collection of function objects, also known as functors.


 




相关文章

相关软件