📄 doc_introduction.html
字号:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Author" CONTENT="Zafir Anjum">
<TITLE>MFC Programmer's SourceBook : STL Programmer's Guide</TITLE>
<META name="description"
content="A freely available implementation
of the C++ Standard Template Library, including
hypertext documentation.">
<META name="keywords"
content="generic programming, STL, standard template library">
</HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
var adcategory = "cpp";
// -->
</SCRIPT>
<body background="../../fancyhome/back.gif" bgcolor="#FFFFFF" >
<SCRIPT LANGUAGE="JavaScript"><!--
var nfrm = location.href.indexOf("_nfrm_");
var validframes = (top.frames.length > 0 && top.frames['ad'] && top.frames['logo'] );
var random = Math.random();
if( !validframes && nfrm == -1 )
{
var dclkPage = "www.codeguru.com/";
if( self.adcategory )
dclkPage += adcategory;
else
dclkPage += "mfc";
document.write('<nolayer><center>');
document.write('<iframe src="http://ad.doubleclick.net/adi/' + dclkPage + ';ord='
+ random + '" width=470 height=62 marginwidth=0 marginheight=0 hspace=0 vspace=0 '
+ 'frameborder=0 scrolling=no bordercolor="#000000">');
document.write('<a href="http://ad.doubleclick.net/jump/' + dclkPage + ';ord='
+ random + '">');
document.write('<img src="http://ad.doubleclick.net/ad/' + dclkPage + ';ord='
+ random + '" height=60 width=468>' + '</a>');
document.write('</iframe>');
document.write('</center></nolayer>');
document.write('<layer src="http://ad.doubleclick.net/adl/' + dclkPage +
';ord=' + random + '"></layer>');
document.write('<ilayer visibility=hide width=468 height=83></ilayer>');
}
// top.location = "/show.cgi?" + adcategory + "=" + location.pathname;
// -->
</SCRIPT>
<noscript>
<p align="center">
<a href="http://ad.doubleclick.net/jump/www.codeguru.com/cpp;ord=NupaBNFCY34AAHbDKU8">
<img src="http://ad.doubleclick.net/ad/www.codeguru.com/cpp;ord=NupaBNFCY34AAHbDKU8"></a>
</p>
</noscript>
<CENTER><H1 ALIGN="CENTER">How to use the STL documentation</H1>
</CENTER><P>
This site documents all of the components (classes, functions, and
concepts) in the SGI Standard Template Library. Each page describes a
single component, and also includes links to related components. </P>
<P>
This documentation assumes a general familiarity with C++, especially
with C++ templates. Additionally, you should read <A
HREF="stl_introduction.html">Introduction to the Standard Template
Library</A> before proceeding to the pages that describe individual
components: the introductory page defines several terms that are used
throughout the documentation.</P>
<H2>
Classification of STL components</H2>
<P>
The STL components are divided into six broad categories on the basis
of functionality: <I>Containers</I>, <I>Iterators</I>, <I>Algorithms</I>, <I>Function
Objects</I>, <I>Utilities</I>, and <I>Allocators</I>; these categories
are defined in the <A HREF="stl_introduction.html">Introduction</A>,
and the <A HREF="table_of_contents.html">Table of Contents</A> is
organized according to them. </P>
<P>
The STL documentation contains two indices. One of them, the <A
HREF="stl_index.html">Main Index</A>, lists all components in
alphabetical order. The other, the <A HREF="stl_index_cat.html">Divided
Index</A>, contains a separate alphabetical listing for each category.
The Divided Index includes one category that is not present in the
Table of Contents: <I>Adaptors</I>. An adaptor is a class or a
function that transforms one interface into a different one. The reason
that adaptors don't appear in the Table of Contents is that no
component is merely an adaptor, but always an adaptor and something
else; <TT><A href="stack.html">stack</A></TT>, for example, is a container and an adaptor.
Accordingly, <TT><A href="stack.html">stack</A></TT> appears in two different places in the
Divided Index. There are several other components that appear in the
Divided Index in more than one place. </P>
<P>
The STL documentation classifies components in two ways.
<OL>
<LI><i>Categories</i> are a classification by functionality.
The categories are:
<UL>
<LI>Container
<LI>Iterator
<LI>Algorithm
<LI>Function Object
<LI>Utility
<LI>Adaptor
<LI>Allocator.
</UL>
<LI><i>Component types</i> are a structural classification: one
based on what kind of C++ entity (if any) a component is. The
component types are:
<UL>
<LI>Type (<i>i.e.</i> a <TT>struct</TT> or <TT>class</TT>)
<LI>Function
<LI>Concept (as defined in the
<A HREF="stl_introduction.html">Introduction</A>).
</UL>
</OL>
</P>
<P>
These two classification schemes are independent, and each of them
applies to every STL component; <TT><A href="Vector.html">vector</A></TT>, for example, is a <I>type</I>
whose category is <I>Containers</I>, and <B><A href="ForwardIterator.html">Forward Iterator</A></B>
is a <I>concept</I> whose category is <I>Iterators</I>. </P>
<P>
Both of these classification schemes appear at the top of every page
that documents an STL component. The upper left corner identifies the
the component's category as <I>Containers</I>,<I> Iterators</I>, <I>Algorithms</I>, <I>Function
Objects</I>, <I>Utilities</I>, <I>Adaptors</I>, or <I>Allocators</I>,
and the upper right corner identifies the component as a <I>type</I>, a <I>function</I>,
or a <I>concept</I>. </P>
<H2>
Using the STL documentation</H2>
<P>
The STL is a <I>generic</I> library: almost every class and function is
a template. Accordingly, one of the most important purposes of the STL
documentation is to provide a clear description of which types may be
used to instantiate those templates. As described in the <A
HREF="stl_introduction.html">Introduction</A>, a <I>concept </I>is a
generic set of requirements that a type must satisfy: a type is said to
be a <I>model of</I> a concept if it satisfies all of that concept's
requirements. </P>
<P>
Concepts are used very heavily in the STL documentation, both because
they directly express type requirements, and because they are a tool
for organizing types conceptually. (For example, the fact that <TT><A href="ostream_iterator.html">ostream_iterator</A></TT>
and <TT><A href="insert_iterator.html">insert_iterator</A></TT> are both models of <B><A href="OutputIterator.html" tppabs="http://www.sgi.com/Technology/STL/OutputIterator.shtml">Output Iterator</A></B>
is an important statement about what those two classes
have in common.) Concepts are used for the documentation of both <I>types</I>
and <I>functions</I>.</P>
<H3>
The format of a <I>concept </I>page</H3>
<P>
A page that documents a <I>concept</I> has the following sections. </P>
<UL>
<LI>
<B>Summary:</B> A description of the concept's purpose.
<LI>
<B>Refinement of:</B> A list of other concepts that this concept <I>refines</I>,
with links to those concepts.
<LI>
<B>Associated types:</B> A concept is a set of requirements on some
type. Frequently, however, some of those requirements involve some
other type. For example, one of the<B> <A href="UnaryFunction.html">Unary Function</A></B>
requirements is that a <B><A href="UnaryFunction.html">Unary Function</A></B> must have an <I>argument
type</I>; if <TT>F</TT> is a type that models <B><A href="UnaryFunction.html">Unary Function</A></B>
and <TT>f</TT> is an object of type <TT>F</TT>, then, in the
expression <TT>f(x)</TT>, <TT>x</TT> must be of <TT>F</TT>'s
argument type. If a concept does have any such associated types, then
they are defined in this section.
<LI>
<B>Notation</B>: The next three sections, <B>definitions</B>, <B>valid
expressions</B>, and <B>expression semantics</B>, present
expressions involving types that model the concept being defined. This
section defines the meaning of the variables and identifiers used in
those expressions.
<LI>
<B>Definitions</B>: Some concepts, such as <B><A href="LessThanComparable.html">LessThan Comparable</A></B>,
use specialized terminology. If a concept requires
any such terminology, it is defined in this section.
<LI>
<B>Valid Expressions</B>: A type that models a concept is required
to support certain operations. In most cases, it doesn't make sense to
describe this in terms of specific functions or member functions: it
doesn't make any difference, for example, whether a type that models
<B><A href="InputIterator.html">Input Iterator</A></B> uses a global function or a member function to
provide <TT>operator++</TT>. This section lists the expressions
that a type modeling this concept must support. It includes any
special requirements (if any) on the types of the expression's
operands, and the expression's return type (if any).
<LI>
<B>Expression Semantics:</B> The previous section, <B>valid
expressions</B>, lists which expressions involving a type must be
supported; it doesn't, however, define the meaning of those
expressions. This section does: it lists the semantics, preconditions,
and postconditions for the expressions defined in the previous section.
<LI>
<B>Complexity Guarantees</B>: In some cases, the run-time
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -