blob: 07396113163c37dd80f704e6cc192d8bb47ea73b [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed
with this work for additional information regarding copyright
ownership. The ASF licenses this file to you under the Apache
License, Version 2.0 (the License); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.
Copyright 1999-2007 Rogue Wave Software, Inc.
-->
<HTML>
<HEAD>
<TITLE>Overview</TITLE>
<LINK REL=StyleSheet HREF="../rw.css" TYPE="text/css" TITLE="Apache stdcxx Stylesheet"></HEAD>
<BODY BGCOLOR=#FFFFFF>
<A HREF="4.html"><IMG SRC="images/bprev.gif" WIDTH=20 HEIGHT=21 ALT="Previous file" BORDER=O></A><A HREF="noframes.html"><IMG SRC="images/btop.gif" WIDTH=56 HEIGHT=21 ALT="Top of Document" BORDER=O></A><A HREF="booktoc.html"><IMG SRC="images/btoc.gif" WIDTH=56 HEIGHT=21 ALT="Contents" BORDER=O></A><A HREF="tindex.html"><IMG SRC="images/bindex.gif" WIDTH=56 HEIGHT=21 ALT="Index page" BORDER=O></A><A HREF="4-2.html"><IMG SRC="images/bnext.gif" WIDTH=25 HEIGHT=21 ALT="Next file" BORDER=O></A><DIV CLASS="DOCUMENTNAME"><B>Apache C++ Standard Library User's Guide</B></DIV>
<H2>4.1 Overview</H2>
<A NAME="idx58"><!></A>
<P>The C++ Standard Library provides ten alternative forms of containers and three container adaptors. In this chapter we briefly identify these forms, consider their characteristics, and discuss how you might go about selecting which form to use in solving a particular problem. Subsequent chapters then go over each of the different forms in more detail.</P>
<P><A HREF="4-1.html#Table&nbsp;6">Table&nbsp;6</A> lists the container types provided by the C++ Standard Library, and describes the most significant characteristic of each. <A HREF="4-1.html#Table&nbsp;7">Table&nbsp;7</A> does the same for the container adaptors.</P>
<H4><A NAME="Table&nbsp;6">Table&nbsp;6: Container types provided by the C++ Standard Library&nbsp;</A></H4>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="3">
<tr><td valign=top><B>Name</B>
</td><td valign=top><B>Characteristic</B>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>vector</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Random access to elements, efficient insertion at back</P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>vector&lt;bool&gt;</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Specialization of <SAMP>vector</SAMP> optimized for <SAMP>bool</SAMP></P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>list</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Efficient insertion and removal throughout</P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>deque</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Random access, efficient insertion at front or back</P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>set</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Elements maintained in order, efficient tests for inclusion, insertion, and removal</P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>multiset</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Set with repeated copies</P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>bitset</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Bit container. Specialized on size rather than contained type</P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>map</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Access to values via keys, efficient insertion and removal</P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>multimap</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Map permitting duplicate keys</P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>string</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Character container enhanced for string operations</P>
</td></tr>
</TABLE>
<A NAME="idx59"><!></A>
<H4><A NAME="Table&nbsp;7">Table&nbsp;7: Container adaptors of the C++ Standard Library</A></H4>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="3">
<tr><td valign=top><B>Name</B>
</td><td valign=top><B>Characteristic</B>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>stack</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Insertions and removals only from back</P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>queue</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Insertions at back, removals from front</P>
</td></tr>
<tr><td valign=top><P CLASS="TABLE"><SAMP>priority_queue</SAMP></P>
</td><td valign=top><P CLASS="TABLE">Efficient access and removal of highest priority items</P>
</td></tr>
</TABLE>
<BR>
<HR>
<A HREF="4.html"><IMG SRC="images/bprev.gif" WIDTH=20 HEIGHT=21 ALT="Previous file" BORDER=O></A><A HREF="noframes.html"><IMG SRC="images/btop.gif" WIDTH=56 HEIGHT=21 ALT="Top of Document" BORDER=O></A><A HREF="booktoc.html"><IMG SRC="images/btoc.gif" WIDTH=56 HEIGHT=21 ALT="Contents" BORDER=O></A><A HREF="tindex.html"><IMG SRC="images/bindex.gif" WIDTH=56 HEIGHT=21 ALT="Index page" BORDER=O></A><A HREF="4-2.html"><IMG SRC="images/bnext.gif" WIDTH=20 HEIGHT=21 ALT="Next file" BORDER=O></A>
<!-- Google Analytics tracking code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1775151-1";
urchinTracker();
</script>
<!-- end of Google Analytics tracking code -->
</BODY>
</HTML>