📄 assoc.htm
字号:
<html>
<head>
<title> The Common Associative Container Methods</title>
</head>
<body bgcolor="#FFFFFF">
<pre>
<font size=4 color=green>Class Name</font> basic_istringstream<br>
Classification Associative Containers<br>
<h1>Methods</h1>
<pre>
<a href="assoc.htm#count">size_type count(const key_type& x) const</a><br>
<a href="assoc.htm#erase1">void erase(iterator Pos)</a><br>
<a href="assoc.htm#erase2">size_type erase(const key_type& X)</a><br>
<a href="assoc.htm#erase3">void erase(iterator First, iterator Last)</a><br>
<a href="assoc.htm#equal">pair<iterator,iterator> equal_range(const key_type& X)</a><br>
<a href="assoc.htm#insert1">pair<iterator, bool> insert(const value_type& X)</a><br>
<a href="assoc.htm#insert2">iterator insert(iterator Pos, const value_type& X)</a><br>
<a href="assoc.htm#insert3">template <class InputIterator> void insert(InputIterator First, InputIterator Last)</a><br>
<a href="assoc.htm#find1">iterator find(const key_type& X)</a><br>
<a href="assoc.htm#find1">const_iterator find(const key_type& X) const</a><br>
<a href="assoc.htm#lower">iterator lower_bound(const key_type& X)</a><br>
<a href="assoc.htm#lower">const_iterator lower_bound(const key_type& X) const</a><br>
<a href="assoc.htm#upper">iterator upper_bound(const key_type& X)</a><br>
<a href="assoc.htm#upper">const_iterator upper_bound(const key_type& X) const</a><br>
</pre>
<pre>
<a name="count">Method count()</a>
Access Public
Classification Accessor
Syntax size_type count(const key_type& x) const
Parameters X is the object to be counted.
Return This method returns the number of objects with keys
equal to x.
</pre>
<h3>Description</h3>
<p>
The count() method returns the number of objects with keys equal to X.
</p>
<hr>
<pre>
<a name="insert1">Method insert()</a>
Access Public
Classification Modifier
Syntax pair<iterator, bool> insert(const value_type& X)
Parameters X is the object to be inserted into the container.
Return returns a pair object that contains a bool and a iterator.
The bool indicates whether an insertion was made. If an
insertion was made the iterator points to the object.
</pre>
<h3>Description</h3>
<p>
This insert() method inserts X into the container if there is no other object that
has the same key.
</p>
<hr>
<pre>
<a name="insert2">Method insert()</a>
Access Public
Classification Modifier
Syntax iterator insert(iterator Pos, const value_type& X)
Parameters X is the object to be inserted after Position Pos.
Return This method returns the iterator pointing to the newly inserted
object.
</pre>
<h3>Description</h3>
<p>
This insert() method inserts object X after Position Pos in the container.
</p>
<hr>
<pre>
<a name="insert3">Method insert()</a>
Access Public
Classification Modifier
Syntax template <class InputIterator> void insert (InputIterator First, InputIterator Last)
Parameters [First,Last) is the range of objects that will be inserted into the
container.
Return None
</pre>
<h3>Description</h3>
<p>
This insert() method inserts the objects in the range [First,Last] before position
Pos in the container.
</p>
<hr>
<pre>
<a name="erase1">Method erase()</a>
Access Public
Classification Modifier
Syntax iterator erase(iterator Pos)
Parameters Pos points to the object to be deleted.
Return None
</pre>
<h3>Description</h3>
<p>
This erase() method deletes the object pointed to by Pos.
</p>
<hr>
<pre>
<a name="erase2">Method erase()</a>
Access Public
Classification Modifier
Syntax size_type erase(const key_type& X)
Parameters X is the key of elements to be erased.
Return None
</pre>
<h3>Description</h3>
<p>
This erase() method deletes all objects in the container whose key = X.
</p>
<hr>
<pre>
<a name="erase3">Method erase()</a>
Access Public
Classification Modifier
Syntax iterator erase(iterator First, iterator Last)
Parameters [First,Last) contains the range of objects to
be deleted
Return None
</pre>
<h3>Description</h3>
<p>
This erase() method deletes the objects in the range [First,Last).
</p>
<hr>
<pre>
<a name="equal">Method equal_range()</a>
Access Public
Classification Accessor
Syntax pair<iterator,iterator> equal_range(const key_type& X)
Parameters X is the object that is being searched for.
Return This method returns a set of iterators with the first
equal to lower_bound(X), and the second equal to upper_bound(X).
</pre>
<h3>Description</h3>
<p>
This equal_range() method returns a pair object that contains two iterators. The
first iterator is lower_bound(X), and the second iterator is upper_bound(X).
</p>
<hr>
<pre>
<a name="find1">Method find()</a>
Access Public
Classification Accessor
Syntax iterator find(const key_type& X)
Parameters X is the key of the object that is being searched for.
Return If the object is found this method returns an iterator pointing
to the object. Otherwise this method returns end().
</pre>
<h3>Description</h3>
<p>
The find() method locates an object in a container and returns an iterator pointing to that
object if it is in the container. Otherwise find() returns end().
</p>
<hr>
<pre>
<a name="lower">Method lower_bound()</a>
Access Public
Classification Accessor
Syntax iterator lower_bound(const key_type& X)
Parameters X is the key of the object that is being searched for.
Return If the object is found this method returns an iterator pointing
to the object. Otherwise this method returns an iterator pointing
to the next object that has a key greater than X.
</pre>
<h3>Description</h3>
<p>
The lower_bound() method locates an object in a container and returns an iterator pointing to that
object if it is in the container. Otherwise it returns an iterator pointing to the next object
whose key is larger than X. If container is empty lower_bound() returns end().
</p>
<hr>
<pre>
<a name="upper">Method upper_bound()</a>
Access Public
Classification Accessor
Syntax iterator upper_bound(const key_type& X)
Parameters X is the key of the object that is being searched for.
Return This method always returns an iterator pointing
to the next object whose key is greater than X.
</pre>
<h3>Description</h3>
<p>
The upper_bound() method locates an object in a container and returns an iterator pointing to
the next object whose key is greater than X. If the container is empty upper_bound()
returns end().
</p>
<hr>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -