<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
C++ Sets [C++ Reference]
</title>
<meta name="generator" content="DokuWiki Release 2009-12-25c "Lemming"" />
<meta name="robots" content="index,follow" />
<meta name="date" content="2009-11-02T07:51:06-0800" />
<meta name="keywords" content="stl,set,start" />
<link rel="search" type="application/opensearchdescription+xml" href="/wiki/lib/exe/opensearch.php" title="C++ Reference" />
<link rel="start" href="/wiki/" />
<link rel="contents" href="/wiki/stl/set/start?do=index" title="Index" />
<link rel="alternate" type="application/rss+xml" title="Recent Changes" href="/wiki/feed.php" />
<link rel="alternate" type="application/rss+xml" title="Current Namespace" href="/wiki/feed.php?mode=list&ns=stl:set" />
<link rel="edit" title="Edit this page" href="/wiki/stl/set/start?do=edit" />
<link rel="alternate" type="text/html" title="Plain HTML" href="/wiki/_export/xhtml/stl/set/start" />
<link rel="alternate" type="text/plain" title="Wiki Markup" href="/wiki/_export/raw/stl/set/start" />
<link rel="canonical" href="http://www.cppreference.com/wiki/stl/set/start" />
<link rel="stylesheet" media="all" type="text/css" href="/wiki/lib/exe/css.php?s=all&t=custom1&tseed=1272971091" />
<link rel="stylesheet" media="screen" type="text/css" href="/wiki/lib/exe/css.php?t=custom1&tseed=1272971091" />
<link rel="stylesheet" media="print" type="text/css" href="/wiki/lib/exe/css.php?s=print&t=custom1&tseed=1272971091" />
<script type="text/javascript" charset="utf-8" ><!--//--><![CDATA[//><!--
var NS='stl:set';var JSINFO = {"id":"stl:set:start","namespace":"stl:set"};
//--><!]]></script>
<script type="text/javascript" charset="utf-8" src="/wiki/lib/exe/js.php?tseed=1272971091" ></script>
<link rel="shortcut icon" href="/wiki/lib/tpl/custom1/images/favicon.png" />
</head>
<body>
<div class="dokuwiki">
<div class="stylehead">
<div class="breadcrumbs">
<span class="bchead">You are here: </span><a href="../../start.html" title="start">C++ Reference</a> » <a href="../../stl/start.html" title="stl:start">C++ Standard Template Library</a> » <a href="../../stl/set/start.html" title="stl:set:start">C++ Sets</a> </div>
</div>
<div class="page">
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2828341-1";
urchinTracker();
</script>
<!-- wikipage start -->
<h1><a name="c_sets" id="c_sets">C++ Sets</a></h1>
<div class="level1">
<p>
set<Key, Compare, Alloc>
</p>
<p>
The C++ Set is an associative STL container that contains a sorted set of unique
objects of type Key. Sorting is done using the key comparison function Compare (default is set to std::less<Key>).
</p>
<table class="inline">
<tr class="row0">
<td class="col0"><a href="../../stl/set/set.html" class="wikilink1" title="stl:set:set_constructors">Constructors</a></td><td class="col1">default methods to allocate, copy, and deallocate sets</td>
</tr>
<tr class="row1">
<td class="col0"><a href="../../stl/set/operator.html" class="wikilink1" title="stl:set:set_operators">Operators</a></td><td class="col1">assign and compare sets</td>
</tr>
<tr class="row2">
<td class="col0"><a href="../../stl/set/begin.html" class="wikilink1" title="stl:set:begin">begin</a></td><td class="col1">returns an iterator to the beginning of the set</td>
</tr>
<tr class="row3">
<td class="col0"><a href="../../stl/set/clear.html" class="wikilink1" title="stl:set:clear">clear</a></td><td class="col1">removes all elements from the set</td>
</tr>
<tr class="row4">
<td class="col0"><a href="../../stl/set/count.html" class="wikilink1" title="stl:set:count">count</a></td><td class="col1">returns the number of elements matching a certain key</td>
</tr>
<tr class="row5">
<td class="col0"><a href="../../stl/set/empty.html" class="wikilink1" title="stl:set:empty">empty</a></td><td class="col1">true if the set has no elements</td>
</tr>
<tr class="row6">
<td class="col0"><a href="../../stl/set/end.html" class="wikilink1" title="stl:set:end">end</a></td><td class="col1">returns an iterator just past the last element of a set</td>
</tr>
<tr class="row7">
<td class="col0"><a href="../../stl/set/equal_range.html" class="wikilink1" title="stl:set:equal_range">equal_range</a></td><td class="col1">returns iterators to the first and just past the last elements matching a specific key</td>
</tr>
<tr class="row8">
<td class="col0"><a href="../../stl/set/erase.html" class="wikilink1" title="stl:set:erase">erase</a></td><td class="col1">removes elements from a set</td>
</tr>
<tr class="row9">
<td class="col0"><a href="../../stl/set/find.html" class="wikilink1" title="stl:set:find">find</a></td><td class="col1">returns an iterator to specific element</td>
</tr>
<tr class="row10">
<td class="col0"><a href="../../stl/set/insert.html" class="wikilink1" title="stl:set:insert">insert</a></td><td class="col1">insert items into a set</td>
</tr>
<tr class="row11">
<td class="col0"><a href="../../stl/set/key_comp.html" class="wikilink1" title="stl:set:key_comp">key_comp</a></td><td class="col1">returns the function that compares keys</td>
</tr>
<tr class="row12">
<td class="col0"><a href="../../stl/set/lower_bound.html" class="wikilink1" title="stl:set:lower_bound">lower_bound</a></td><td class="col1">returns an iterator to the first element greater than or equal to a certain value</td>
</tr>
<tr class="row13">
<td class="col0"><a href="../../stl/set/max_size.html" class="wikilink1" title="stl:set:max_size">max_size</a></td><td class="col1">returns the maximum number of elements that the set can hold</td>
</tr>
<tr class="row14">
<td class="col0"><a href="../../stl/set/rbegin.html" class="wikilink1" title="stl:set:rbegin">rbegin</a></td><td class="col1">returns a reverse_iterator to the end of the set</td>
</tr>
<tr class="row15">
<td class="col0"><a href="../../stl/set/rend.html" class="wikilink1" title="stl:set:rend">rend</a></td><td class="col1">returns a reverse_iterator to the beginning of the set</td>
</tr>
<tr class="row16">
<td class="col0"><a href="../../stl/set/size.html" class="wikilink1" title="stl:set:size">size</a></td><td class="col1">returns the number of items in the set</td>
</tr>
<tr class="row17">
<td class="col0"><a href="../../stl/set/swap.html" class="wikilink1" title="stl:set:swap">swap</a></td><td class="col1">swap the contents of this set with another</td>
</tr>
<tr class="row18">
<td class="col0"><a href="../../stl/set/upper_bound.html" class="wikilink1" title="stl:set:upper_bound">upper_bound</a></td><td class="col1">returns an iterator to the first element greater than a certain value</td>
</tr>
<tr class="row19">
<td class="col0"><a href="../../stl/set/value_comp.html" class="wikilink1" title="stl:set:value_comp">value_comp</a></td><td class="col1">returns the function that compares values</td>
</tr>
</table>
</div>
<!-- wikipage stop -->
</div>
<div class="clearer"> </div>
<div class="stylefoot">
<div class="meta">
<div class="user">
</div>
<!--
<div class="doc">
stl/set/start.txt · Last modified: 11/02/2009 07:51 by 193.2.120.35 </div>
-->
</div>
</div></div></body>
</html>